You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My understanding is that with settings={'DATE_ORDER': 'DMY','PREFER_LANGUAGE_DATE_ORDER':False}, the parser should return None if it cannot parse with the specified DATE_ORDER.
The reason I need the parser to honor the DATE_ORDER (or fail the parse otherwise) is I have documents where the parse format is unknown, but it is known that all the dates in that document have the same parse format. If the DATE_ORDER was honored, I could parse all the dates with different DATE_ORDERs, and pick the DATE_ORDER which is consistent with all the dates in the document.
Could you also check with master? The issue probably remains, but @noviluni has made lots of changes everywhere, so there’s a chance it has been fixed.
First of all, I would like to mention that PREFER_LANGUAGE_DATE_ORDER it's not doing anything, as it's wrong, it should be PREFER_LOCALE_DATE_ORDER. There is an error in the documentation that will be fixed once we merge this: https://github.com/scrapinghub/dateparser/pull/722/files. The new version will be released in a few days, and those wrong settings will raise an error, so this kind of error won't happen again in the future. I apologize for this confusion.
However, even if we change this setting, it fails, and I think it's because the absolute-parser is not using this setting properly.
After releasing the next version (1.0.0) we will check all the settings with all the parsers to see that all are respecting them (see the last point here: #796). But if I have the chance I will try to fix this before.
Activity
Gallaecio commentedon Oct 5, 2020
Could you also check with
master? The issue probably remains, but @noviluni has made lots of changes everywhere, so there’s a chance it has been fixed.ArthurKantor commentedon Oct 5, 2020
Still happens with master as of now.
noviluni commentedon Oct 6, 2020
Hi @ArthurKantor Thank you for raising this.
First of all, I would like to mention that
PREFER_LANGUAGE_DATE_ORDERit's not doing anything, as it's wrong, it should bePREFER_LOCALE_DATE_ORDER. There is an error in the documentation that will be fixed once we merge this: https://github.com/scrapinghub/dateparser/pull/722/files. The new version will be released in a few days, and those wrong settings will raise an error, so this kind of error won't happen again in the future. I apologize for this confusion.However, even if we change this setting, it fails, and I think it's because the
absolute-parseris not using this setting properly.After releasing the next version (1.0.0) we will check all the settings with all the parsers to see that all are respecting them (see the last point here: #796). But if I have the chance I will try to fix this before.
alex-triphonov commentedon Oct 26, 2020
@noviluni
I found cause of this issue:
dateparser/date.py
Date order from locales only works with _default settings. Hope this would be fixed soon.