Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't allow negative "nth" specifications in "nth" ranges #68

Open
simonpoole opened this issue Jul 21, 2021 · 4 comments
Open

Don't allow negative "nth" specifications in "nth" ranges #68

simonpoole opened this issue Jul 21, 2021 · 4 comments

Comments

@simonpoole
Copy link
Owner

Does allowing this make any sense? If it does it should definitely throw an exception in strict mode.

@westnordost
Copy link
Contributor

I can't think of any real case where this made sense, i.e. I can't think of an opening hours sign that could be written that way...

"We are open each month until and including the 30th but only every 2nd day"

If negative "nth" actually appear in the wild, I think the chance is higher that it is a typo rather than what the contributor meant.

However, a less ludicrous opening hours sign may say

"open on odd dates, i.e. every 1st, 3rd etc of each month"

If I understood the specification correctly, writing Jan-Dec 1-31/2 is not valid because month ranges are not supported at that spot. But maybe this is something that may be worth supporting in non-strict mode if it isn't yet, I don't have numbers how often this appears in the wild but there are street signs that are valid every second day of each month, see
https://wiki.openstreetmap.org/wiki/Proposed_features/Parking_lane_conditionals#Other_signage

@simonpoole
Copy link
Owner Author

However, a less ludicrous opening hours sign may say

"open on odd dates, i.e. every 1st, 3rd etc of each month"

If I understood the specification correctly, writing Jan-Dec 1-31/2 is not valid because month ranges are not supported at that spot. But maybe this is something that may be worth supporting in non-strict mode if it isn't yet, I don't have numbers how often this appears in the wild but there are street signs that are valid every second day of each month, see https://wiki.openstreetmap.org/wiki/Proposed_features/Parking_lane_conditionals#Other_signage

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.

@westnordost
Copy link
Contributor

I don't see how Jan-Dec 1-31/2 would be ambiguous. Maybe in that there is no 31st of February? But anyway, I'll create a new issue for this to no longer hijack this issue about support for negative nth ranges.

@westnordost
Copy link
Contributor

Anyway, regarding this topic, for reference, the specification also does not allow negative nth specifications in ranges. E.g. -3--1 or -2-1 should not be valid:

image
https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#nth_entry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants