OpeningHoursParser icon indicating copy to clipboard operation
OpeningHoursParser copied to clipboard

Understand "nth" ranges with ranges of months in non-strict mode

Open westnordost opened this issue 4 years ago • 2 comments

e.g. Jan-Dec 1-31/2 -> "Open every odd day of month" or the same for every even day of a month.

Use case

Currently, the way to express the above correctly in line with the specification would be Jan 1-31/2, Feb 1-29/2, Mar 1-31/2, Apr 1-30/2, May 1-31/2, Jun 1-30/2, Jul 1-31/2, Aug 1-31/2, Sep 1-30/2, Oct 1-31/2, Nov 1-30/2, Dec 1-31/2

A real life example of such "opening hours" would be this road sign, which is a conditional "no parking" restriction for odd days of a month, found in some countries following the Vienna convention on road signs. It is tagged like parking:condition:*:conditional=no_parking @ (<opening hours>)

It is possible that contributors that happen upon such opening hours (or restrictions) will not use the correct syntax but just use Jan-Dec 1-31/2 or similar because one needs to know the specification really really well to know that at this position, month ranges are not allowed. They are allowed at other positions in the specification after all.

Issues

There are two issues: on the one hand there are no month day ranges that are separate from dates. What is supported is only Jan 1-31 which simply is short hand for Jan 1 - Jan 31, so support would require month day ranges as an independent construct. Not sure if that wouldn't create even more ambiguity in parsing (for example with that shorthand). The 2nd minor issue is adding an interval specification, that is unlikely to be problematic on it's own. - @simonpoole

westnordost avatar Jan 16 '22 18:01 westnordost

I noticed this came up already 4 years ago in @ypid's parser https://github.com/opening-hours/opening_hours.js/issues/252 - with this exact example, to boot.

westnordost avatar May 26 '22 23:05 westnordost

FYI the wiki now suggests to use parking:right:restriction:conditional=no_parking @ ("Odd days of each month") to map these parking "opening hours"

https://wiki.openstreetmap.org/wiki/Street_parking#Alternate_side_parking

westnordost avatar Jan 08 '24 14:01 westnordost