OpeningHoursParser icon indicating copy to clipboard operation
OpeningHoursParser copied to clipboard

Ignoring of dangling `,` after wide range inconsistent

Open westnordost opened this issue 1 year ago • 1 comments

This parser, and also the reference implementation ignores a dangling , at the end of a wide range.

E.g. Apr-Oct,Mo-Fr 08:00-18:00 is (interpreted as and) changed to
Apr-Oct Mo-Fr 08:00-18:00

If it was not changed, the , would be an additional rule separator, making the whole expression mean something else.

This is not documented in the specification, but as far as I can see, it makes sense:

For all opening hours strings I've looked at that had such a dangling , , this parsing behavior made sense - for it each matched the intention of the author. In any case, while this behavior is consistent in opening_hours.js, it is only done in specific situations for this parser:

, is removed

Apr-Oct, Mo 08:00-18:00 Apr, Mo 08:00-18:00 Apr, Mo 08:00 2024, Mo 08:00 Apr 01, Mo 08:00 Apr 01, Mo sunrise 2024, Mo,PH 08:00 week 01-52, Mo 08:00

, is not removed (-> additional rule)

Apr, 08:00 2024, 08:00 Apr, sunrise 2024, PH 08:00 2024, PH,Mo 08:00

In conclusion, , is only removed if a weekday (not PH/SH!) follows any wide range selector

westnordost avatar Jan 12 '24 15:01 westnordost

This would seem to be related to https://github.com/simonpoole/OpeningHoursParser/issues/81

simonpoole avatar Mar 05 '24 15:03 simonpoole