Skip to content

Problems with date parsing #202

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

Open
BelKed opened this issue Jan 11, 2023 · 2 comments
Open

Problems with date parsing #202

BelKed opened this issue Jan 11, 2023 · 2 comments

Comments

@BelKed
Copy link
Contributor

BelKed commented Jan 11, 2023

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
Copy link
Contributor Author

BelKed commented Jan 11, 2023

Or maybe it wouldn't be that hard?

(Every) Geocaching page contains something like this:

<script type="text/javascript">
    var serverParameters = {
        'user:info': {
            isLoggedIn: true,
            username: "...",
            userType: "Basic",
            reqToken: "...",
            publicGuid: "...",
            avatarUrl: "https://www.geocaching.com/images/default_avatar.png",
            dateFormat: "d.M.yyyy",
            ...

@FriedrichFroebel
Copy link
Collaborator

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.

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

No branches or pull requests

2 participants