From https://github.com/osm-fr/osmose-backend/pull/1424#issuecomment-1086725579 STEPS TO REPRODUCE 1. call normalizedExpression() on "2099 May 22-2099 Oct 07" OBSERVED RESULT normalizedExpression() produces "2099 May 22-Oct 07" EXPECTED RESULT No change for normalizedExpression, i.e. output equals input Per https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#selector:month , <monthday_range> gives <date_from> [ <date_offset> ] - <date_to> [ <date_offset> ], <date_from> and <date_to> are defined as (a.o.) [ <year> ] <month> <daynum> Unrelated, but for simplifiedExpression() the output is expected to be simplified to 2099 May 22-Oct 07
Actually when I look at the opening hours specification (https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification) I start to wonder if > 2022 Mar 31 - Apr 16 is really the same as > 2022 Mar 31 - 2022 Apr 16 2022 Mar-Apr is valid per [ <year> ] <month> - <month> 2022 Mar 31 - 2022 Apr 16 is valid per <date_from> [ <date_offset> ] - <date_to> [ <date_offset> ] However, no-where in the specs it mentions how "2022 Mar 31 - Apr 16" should be parsed. So I could argue that this selector would also be valid on 2023 Jan 01 until 2023 Apr 16, 2024 Jan 01 until 2024 Apr 16, ..., in contrast to 2022 Mar 31 - 2022 Apr 16 (which is restricted tot the 2022 date range only)
In addition, I noticed that also "Jan 01-Jan 31" is changed to "Jan 01-31" in normalizedExpression(). (This is valid, no doubt about that, but it would be great if this was only done at simplifiedExpression)
(In reply to fam.lam from comment #1) Please ignore comment 1, it is clearly wrong (can't find how to delete it though). The original description and comment 2 are still correct.
Oh dang, my comment 1 is still correct, I wasn't thinking properly. The opening hours specification doesn't say that the same year should be assumed if <date_from> contains a year, but <date_to> doesn't contain a year.
Git commit 497444553d267b830494f0381b7f820a46a3b2bc by David Faure, on behalf of Fam Lam. Committed on 20/01/2024 at 17:59. Pushed by dfaure into branch 'master'. Keep year if months differ with day (undefined behaviour) M +4 -0 autotests/parsertest.cpp M +1 -1 src/lib/selectors.cpp https://invent.kde.org/libraries/kopeninghours/-/commit/497444553d267b830494f0381b7f820a46a3b2bc
Git commit bc12a820326f564e00c6533008e027b321fa6644 by Volker Krause, on behalf of Fam Lam. Committed on 13/04/2024 at 08:46. Pushed by vkrause into branch 'release/24.02'. Keep year if months differ with day (undefined behaviour) (cherry picked from commit 497444553d267b830494f0381b7f820a46a3b2bc) M +4 -0 autotests/parsertest.cpp M +1 -1 src/lib/selectors.cpp https://invent.kde.org/libraries/kopeninghours/-/commit/bc12a820326f564e00c6533008e027b321fa6644