spice_ev.util.datetime_within_window

spice_ev.util.datetime_within_window(dt, time_windows)

Check if a given datetime is within any of the given time windows.

The times pertain to all dates within the window:
E.g., 14.03. 9:00 - 14.05. 11:00 means 09:00 - 11:00 for all days in two months.
14.04. 10:00 is within this example window, 14.04. 12:00 is not.
Parameters:
  • dt (datetime) – time

  • time_windows (dict) – Structure of time_windows: {season: {“start”: datetime with start date and start time, “end”: datetime with end date and end time}}

Returns:

is datetime within time windows?

Return type:

bool