simonpoole / OpeningHoursParser

Parser for string values according to the OSM opening hours specification
MIT License
32 stars 12 forks source link

Weekdays with mixed-in holidays not sorted correctly #87

Closed westnordost closed 7 months ago

westnordost commented 9 months ago

The readme states:

In non-strict mode the following further differences are allowed: [...]

  • holidays in weekday range

and this also works. However, the expectation is that holidays mixed into weekday ranges are sorted correctly either to the front or back (both is allowed) when pretty-printing it so that the outputted string is a valid opening hours string. This does not work for e.g.

PH,Su,SH,Tu-Fr 18:00-20:00

It is simply changed to PH,Su, SH,Tu-Fr 18:00-20:00.

simonpoole commented 7 months ago

I quote from the code :-)

// holiday handling is painful

that actually looks like a parsing issue though, output should have individual holidays, then the weekday range with the day like holidays appended.