Skip to content

Ignoring of dangling , after wide range inconsistent #89

@westnordost

Description

@westnordost

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions