simonpoole / OpeningHoursParser

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

Pretty printing `2023 Jul 21,28` creates new ambiguity #88

Closed westnordost closed 8 months ago

westnordost commented 10 months ago

In non-strict mode, this parser is able to parse

list of month days after months ( Jan 1,4,5 )

When pretty-printing this date, it corrects it to a valid date list, in the case above Jan 01,Jan 04,Jan 05.

In the case that a year is specified, the logic that generates the string creates ambiguities in the resulting string that didn't exist in the source string:

2023 Jul 21,28 10:00-18:00 is converted to 2023 Jul 21,Jul 28 10:00-18:00

Previously, the rule was clear that it is not opened outside of July 2023. Now, it could be read that generally, it is open July 28th. This creation of an ambiguity could be avoided by instead converting the source string to

2023 Jul 21,2023 Jul 28 10:00-18:00

i.e. ascribing the year selector to the month/date selector if there is only a single year and only single month/date selector.