pycaching icon indicating copy to clipboard operation
pycaching copied to clipboard

Problems with date parsing

Open BelKed opened this issue 2 years ago • 2 comments

As I recently realised, there are many date formats supported by Geocaching. Although, some of them are not parsed correctly. The problem is about exchanging days and months. (By the way, this problem was there before my PR #201)

Example: (All dates should be 2022-01-09)

9. 01. 2023      2023-01-09
9.1.2023         2023-01-09
9.1.2023 г.      2023-01-09
9/1/2023         2023-09-01
9/01/2023        2023-09-01
09 Jan 23        2023-01-09
09.01.23         2023-01-09
09.01.2023       2023-01-09
09.Jan.2023      2023-01-09
09/01/2023       2023-09-01
09/Jan/2023      2023-01-09
09-01-23         2023-01-09
09-01-2023       2023-01-09
9-1-2023         2023-01-09
1/9/2023         2023-01-09
01/09/2023       2023-01-09
Jan/09/2023      2023-01-09
2023. 1. 9.      2023-01-09
2023. 01. 09.    2023-01-09
2023/01/09       2023-01-09
2023-01-09       2023-01-09

I can't think of a simple solution because 09/01/2023 and 01/09/2023, 9/1/2023 and 1/9/2023...

BelKed avatar Jan 11 '23 21:01 BelKed

Or maybe it wouldn't be that hard?

(Every) Geocaching page contains something like this:

BelKed avatar Jan 11 '23 21:01 BelKed

Thanks for the report. Guessing the date format can always lead to wrong results, so explicit is better than implicit. As GC apparently ships the corresponding data, we should probably try to use it.

Feel free to give it a try to retrieve the explicit date format and only fall back to guessing if it is missing for some reason.

FriedrichFroebel avatar Jan 12 '23 08:01 FriedrichFroebel