Bug 446137 - Handle missing colon
Summary: Handle missing colon
Status: RESOLVED FIXED
Alias: None
Product: KOpeningHours
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Volker Krause
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-26 20:16 UTC by HubMiner
Modified: 2021-12-05 10:35 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description HubMiner 2021-11-26 20:16:30 UTC
IN  0700-2000
OUT 07:00-20:00

IN  Tu-Th 8:30-17:30, Fr 8:30-1700
OUT Tu-Th 08:30-17:30, Fr 08:30-17:00
Comment 1 Volker Krause 2021-11-26 21:15:25 UTC
This is indeed a somewhat common mistake in OSM data. It's unfortunately not easy to support (if possible at all), as 4 digit numbers match year numbers as well. Ie. "1900-2100" is a valid expression, but it's a year range, not a time range.
Comment 2 HubMiner 2021-11-29 19:02:55 UTC
Thanks for taking a look at this, I agree this is a frequent mistake.
Random ideas:
- Is it possible to parse in stages, so after likely year placeholders are parsed, prefer that that 4 digits represent hhmm?
- Is it possible to tighten year definition: 
    1900: drop or deprioritize 19## as year
    20[0-3]#: recognize this as year, drop or deprioritize anything after that.
Comment 3 Volker Krause 2021-11-29 19:42:54 UTC
Right, accepting 4 digit numbers that are a valid time and that fall outside of the expected year values should be possible and could probably cover the majority of these cases already. I'll give that a try.
Comment 4 Bug Janitor Service 2021-11-30 17:18:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/libraries/kopeninghours/-/merge_requests/81
Comment 5 Volker Krause 2021-12-05 10:35:46 UTC
Git commit 024831289df89c2282637eea7bfe774286b20b22 by Volker Krause.
Committed on 05/12/2021 at 10:32.
Pushed by vkrause into branch 'release/21.12'.

Support 4 digit times to the extend possible

The problem with 4 digit times is the ambiguity with year numbers. To solve
this we now assume anything that would be a valid time outside of the
[2001-2099] range to be a time. That leaves all practically relevant years
valid and still covers the vast majority of 4 digit times found in the OSM
corpus.

This is worth it given how common the 4 digit time mistake is in OSM data.

M  +2    -2    autotests/evaluatetest.cpp
M  +5    -1    autotests/parsertest.cpp
M  +12   -6    src/lib/openinghourslexer.l
M  +4    -0    src/lib/openinghoursparser.y

https://invent.kde.org/libraries/kopeninghours/commit/024831289df89c2282637eea7bfe774286b20b22