simonpoole / OpeningHoursParser

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

`Mo-Su 24/7` not parseable in non-strict mode #83

Closed westnordost closed 10 months ago

westnordost commented 10 months ago

The readme claims that in non-strict mode:

  • 24/7 rules with preceding selectors are corrected to 00:00-24:00 time spans

However, parsing Mo-Su 24/7 fails with

ch.poole.openinghoursparser.OpeningHoursParseException: Encountered:  "24/7" "24/7 " at line 1, column 4
Was expecting: <EOF>
simonpoole commented 10 months ago

This is a documentation error, the correction only applies to year, week and date selectors, mainly because even though not quite correct it would seem to be useful, individual weekdays on the other hand are obvious nonsense in conjunction with 24/7. Yes I know that some people have heavily pushed for an interpretation of 24/7 to actually just mean 24 hours.

westnordost commented 10 months ago

Well, you would certainly not bless its usage if it was understood only in non-strict mode and subsequently corrected to 00:00-24:00 on output. If the parser does not understand it at all, it can also not be (automatically) corrected. The intention of the examples I've looked at looked pretty unambiguous to me.