Hours of operation
Examples of formatting Location hours of operation
Hours formatter
Example of starting the formatter by passing primary hours of a location
Hours formatter options
Additional options can be passed to the formatter to change its behavior. Example of passing in options
Available options
disable_special_hours
(default False) - This option disables using special hours when listing the days' hours. By default, when outputting hours they will be contextual to any special hours coming up for a day. For example, if is Monday and there is special hours for this Thursday, it will adjust the hours listed to show the special hours on Thursday.
Formatting options
Each of the following methods have a few options for outputting the hours
hide_closed_days
(default False) - this option will exclude days that are closedgroup_days
(default False) - this option will group similar days that have the same hours to save the number of lines needed
as_br
as_br
Output hours one per line separated by <br />
filtered_days
filtered_days
For custom templating options. Below example of outputting the hours into a table.
Multiple time ranges in a day
Days can also have multiple ranges of time that they are open. For example if the location is closed for lunch but then opens again for dinner.
By default, the value of day.content
will have both ranges separated by commas.
9:00 AM - 12:00 PM, 5:00 PM - 9:00 PM
If you want more formatting options, you can also loop over each range within your template using day.ranges.items
. If there is no ranges, then the day is closed and day.content
is used to display "Closed"
Other utilities
special_hours_days
special_hours_days
This can be used to list upcoming special hours dates and times for a location.
Example output
Additional options
Additional options can be passed into the special_hours_days
day_format
- Specify the format to be used for each day's label. Default is'%b %-d'
. Example of another would be%b %-d, %Y
which would output the days asJan 1, 2022
days_in_future
- Number of days into the future to get special hours. Default is30
to show upcoming special hours in the next 30 days.
Example
todays_hours
todays_hours
Output the content of todays hours
Finder Support for todays_hours
all_days_closed
all_days_closed
Check to see if all days within the week are closed. It returns True/False. Can be used to hide a section if there are no open hours and instead show a different message
is_open_now
is_open_now
Check to see if this location is currently open. This uses the location timezone.
closes_next
closes_next
Get the next "closing time". Only use this if you know that the location is currently open (using is_open_now
).
Last updated