opening-hours / opening_hours.js

Library to parse and process the opening_hours tag from OpenStreetMap data
https://openingh.ypid.de/evaluation_tool/
225 stars 121 forks source link

prettifyValue() doesn't replace holiday tokens if they occur in combination with weekdays #319

Open tboegner opened 4 years ago

tboegner commented 4 years ago

Rule example for replacement is working: PH off Replacement for lang=de -> Feiertags geschlossen

Rule example for replacement not working (combination): Mo,PH off Replacement for lang=de -> Mo,PH geschlossen

ypid commented 3 years ago

https://openingh.openstreetmap.de/evaluation_tool fixes "Mo,PH geschlossen" to "Mo,PH off". Can you retest?

The input tolerance is not language dependent btw. This is only the display language. The oh value and prettifyValue do not depend on it. But the warnings are translated. The idea is that a user might be working on OH values in a country with a different language than their own preferred language.

tboegner commented 3 years ago

The evaluation tool works as you described.

If I get you right, it doesn't take the language into account for the output of pretifyValue. So it can't be used to test the behaviour which this issue and the workaround tries to address. The original scenario was using the pretifyValue function in another application for displaying the opening_hours value in a user readable and translated form. So the expected output for the use case with german is "Mo, Feiertags geschlossen".

ypid commented 3 years ago

Now I get it and can reproduce it with interactive_testing.js. I am open to a PR.