Skip to content

Opening Hours Parse error #1154

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

Closed
midnightcomm opened this issue May 1, 2015 · 6 comments
Closed

Opening Hours Parse error #1154

midnightcomm opened this issue May 1, 2015 · 6 comments

Comments

@midnightcomm
Copy link

POI Seems to have correct format for opening_hours, however, OSMAND is not parsing the tag as expected. Showing the place as closed when it is actually open.

Might have something to do with use of commas/semi-colon.

Mo-Th 09:00-21:00, Fr-Sa 09:00-17:00, Su off

Screenshot
POI Example
Validation Result

Related Issue

@ypid
Copy link
Contributor

ypid commented May 9, 2015

Actually, the use of <additional_rule_separator>, which is not supported by OSMand, is not recommended for this value. Rewrite as "Mo-Th 09:00-21:00; Fr-Sa 09:00-17:00; Su off".
Parsing the <additional_rule_separator> is difficult …
In case the opening_hours are something like "Mo-Th 09:00-03:00, Fr-Sa 09:00-04:00; Su,PH off", OSMand is going to fail.

That said, I would also like to see issue #473 fixed.

@vshcherb
Copy link
Member

vshcherb commented May 9, 2015

I don't expect any time soon to use javascript library especially we used this function in a critical way for search.
I expect
"Mo-Th 09:00-03:00, Fr-Sa 09:00-04:00; Su,PH off",
that this will fail with PH detecting but won't fail with other values

@vshcherb vshcherb closed this as completed May 9, 2015
@ypid
Copy link
Contributor

ypid commented May 9, 2015

Wrong. The value "Tu-Th 07:00-2:00, Fr 17:00-4:00, Sa 18:00-05:00; Su,Mo off" throws an exception:
Exception in thread "main" java.lang.NullPointerException
at OpeningHoursParser.testOpened(OpeningHoursParser.java:700)
at OpeningHoursParser.main(OpeningHoursParser.java:800)

For "Mo-Th 09:00-03:00, Fr-Sa 09:00-04:00; Su off", it does not throw an exception but is evaluated wrong. See #1192.

I intend to bundle the javascript library into a Java library (.jar) in the future. Would you consider using it then?

vshcherb pushed a commit that referenced this issue May 9, 2015
vshcherb added a commit that referenced this issue May 9, 2015
Added test for "Mo-Th 09:00-03:00, Fr-Sa 09:00-04:00; Su off". Not evaluated correctly. Related to #1154.
@midnightcomm
Copy link
Author

Made a note on OSM Wiki for future editors/users.

https://wiki.openstreetmap.org/wiki/Key:opening_hours#OsmAnd

@vshcherb
Copy link
Member

To avoid sort of confusion.
This syntax is supported: "Mo-We, Fr 08:30-14:40,15:00-19:00", "Mo-Sa 08:30-14:40; Tu 08:00 - 14:00"
But this won't work: "Mo-Sa 08:30-14:40, Tu 08:00 - 14:00" (not sure though it is correct version at all)

@ypid
Copy link
Contributor

ypid commented May 10, 2015

It is not incorrect, but not intended/recommended/needed. The preferred rule separator should always be ;. Please read the explanation of the syntax and the comments of this issue.

So, in this case, there is no reason to use ,. Just write it as Mo-Sa 08:30-14:40; Tu 08:00-14:00.

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

No branches or pull requests

3 participants