Skip to content

Commit

Permalink
fix black
Browse files Browse the repository at this point in the history
  • Loading branch information
petrjasek committed Dec 11, 2024
1 parent 9482826 commit f633f1c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/planning/events/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,10 @@ def _validate_dates(self, updates, original=None):
if not start_date or not end_date:
raise SuperdeskApiError(message="Event START DATE and END DATE are mandatory.")

if dates.get("no_end_time") == True and end_date.date() < get_local_date(dates.get("start"), dates.get("tz")).date():
if (
dates.get("no_end_time") == True
and end_date.date() < get_local_date(dates.get("start"), dates.get("tz")).date()
):
raise SuperdeskApiError(message="END TIME should be after START TIME")
elif dates.get("no_end_time") != True and end_date < start_date:
raise SuperdeskApiError(message="END TIME should be after START TIME")
Expand Down Expand Up @@ -1037,4 +1040,4 @@ def set_planning_schedule(event):


def get_local_date(date: datetime, tz: str) -> datetime:
return date.astimezone(pytz.timezone(tz))
return date.astimezone(pytz.timezone(tz))

0 comments on commit f633f1c

Please sign in to comment.