Opening hours above 24 hours and public holidays

Hello,

I’m finding myself in a bit of an awkward situation with opening hours, where I can’t seem to be able to tag a relatively common situation in a way that results in a proper output.

The situation is as follows:

I have a bus line that runs Monday to Friday from 05:00 to 25:00 and Saturday and Sunday from 06:00 to 24:30. On public holidays, the bus line runs according to the weekend schedule, i.e. from 06:00 to 24:30.

Where this becomes problematic is that I can’t seem to model this properly considering the way that public transit operations have the concept of a “service day” that doesn’t necessarily start and end at midnight.

This means that:

  1. If a holiday falls on a Monday (Such as Labour Day here in Canada, which falls on Monday, September 7th this year):
    1.Service from the previous day (Sunday) ends at 00:30 on Monday;
    2. The day’s service (on the Monday that is a holiday) starts at 06:00 on Monday;
    3. The day’s service (on the Monday that is a holiday) ends at 00:30 on Tuesday;
  2. If the holiday falls on a weekday other than Monday (for instance, on a Thursday, like New Year’s 2026)
    1. Service from the previous day (Wednesday, so weekday schedule) ends at 01:00 on Thursday;
    2. The day’s service (on the Thursday that is a holiday) starts at 06:00 on Thursday;
    3. The day’s service (on the Thursday that is a holiday) ends at 00:30 on Friday.

If I tag opening_hours = Mo-Fr 05:00-25:00; Sa-Su,PH 06:00-24:30 (using a semicolon to separate the rules)

  • If the holiday falls on a Monday
    • The previous day’s service correctly ends at 00:30 on Monday (1.1);
    • The day’s service correctly starts at 06:00 on Monday (1.2);
    • The day’s service incorrectly ends at 01:00 on Tuesday. It should end at 00:30 on Tuesday (1.3).
  • If the holiday falls on another weekday, like New Year’s 2026, on a Thursday
    • The previous day’s service incorrectly ends at 00:30 on Thursday. It should end at 01:00 on Thursday (2.1);
    • The day’s service correctly starts at 06:00 on Thursday (2.2)
    • The day’s service incorrectly ends at 01:00 on Friday. It should end at 00:30 on Friday (2.3).
  • Additionally, this tagging results in regular Friday service incorrectly ending at 24:00 on Friday / 00:00 on Saturday, when it should end at 01:00 on Friday

Otherwise, if I tag opening_hours = Mo-Fr 05:00-25:00, Sa-Su,PH 06:00-24:30 (using a comma to separate the rules), the issues previously described are resolved. However, this results in a new issue: an “additional” opening period is added to holidays between 05:00 and 06:00, seemingly because the holiday is on a weekday and because normally, service starts at 05:00 on Weekdays.

What would be the correct way to indicate opening hours in this situation?

Have not had an in dept look yet. But what are the results when you do opening_hours = Mo-Fr 05:00-25:00, Sa-Su 06:00-24:30; PH 06:00-24:30

Edit sen to fast :slightly_frowning_face:
Edit 2 fix typo

This doesn’t quite work, because it results in the previous day’s service ending at 00:00, which is incorrect. It should either end at 00:30 (if the previous day was a Sunday) or at 01:00 (if the previous day was a weekday)

Maybe PH+1 day Tu works for this? I had tried Sa 08:00-12:00; PH-1day Sa off; PH off

Yep, I just realized that staring at my try :slightly_smiling_face:

To specify opening hours after midnight of a public holiday, you might use something like PH +1 day 00:00-00:30.

Perhaps we need an opening_hours:day_start=04:00 or somesuch?

This is a good idea, but it doesn’t quite solve the issue of the previous day’s service ending at the incorrect time (and that end time is variable depending on if the previous day was a weekday or a weekend).

That wouldn’t solve the problem. We would need rules in the style of “if the day after the holiday is a Tuesday, then the following time applies”. This already exists: PH +1 day, Tu 00:00-00:30

This should be covered by: PH,Mo 00:00-00:30, 06:00-24:00; PH +1 day,Tu 00:00-00:30

That was still wrong. This is better: PH Mo 00:00-00:30, 06:00-24:00; PH +1 day Tu 00:00-00:30

This is the second part of the rule:

PH Tu-Su 00:00-00:30,06:00-24:00; PH +1 day We-Mo 00:00-00:30

I think it could work. Try

Mo 00:00-00:30, 05:00-24:00; 
Tu-Fr 00:00-01:00, 05:00-24:00;
Sa 00:00-01:00, 06:00-24:00;
Su 00:00-00:30, 06:00-24:00;

PH+1day Mo-Fr 00:00-00:30, 05:00-24:00;
PH+1day Sa 00:00-00:30, 06:00-24:00;

PH Su-Mo 00:00-00:30, 06:00-24:00; 
PH Tu-Sa 00:00-01:00, 06:00-24:00

tool to test

This should be the complete rule: Su-Mo 00:00-00:30,06:00-24:00; Tu-Sa 00:00-01:00,06:00-24:00; PH Mo 00:00-00:30,06:00-24:00; PH +1 day Tu 00:00-00:30,06:00-24:00; PH Tu-Su 00:00-00:30,06:00-24:00; PH +1 day We-Mo 00:00-00:30,06:00-24:00

It might be interesting to ask this question to an AI :grinning_face:

It might break if there are 2 consecutive PH.

@9_tab Our rules differ on weekends. I’m not sure if the term “weekdays” of the question covers Mo-Fr or Mo-Sa.

I think “weekdays” here is Mo 04:00-Sa 04:00 ;)

@Dudebrains This should be a good start. I think it’s up to you to find the remaining bugs and typos :grinning_face:

This is it. Thank you for your help, I would have never figured that out. I didn’t imagine it would be so complicated to model this.