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
"String does not match format DDMMMYY" this happens for example when the date is 14NOV22 or 14nov22, and it works only when the first letter of the month is in uppercase 14Nov22.
It would be greate if it works in all those cases.
The strict=False example above is not an equivalent workaround: it returns 2014-11-22, whereas DDMMMYY for 14nov22 means 2022-11-14. That fallback goes through dateutil and its date-order preferences, rather than preserving the supplied format contract.
The current formatter has two relevant layers: _replace_tokens() builds case-sensitive month alternatives, and Locale.match_translation() performs an exact-value lookup. Making only the regex case-insensitive would leave the second layer unmatched; normalize the captured month and lookup candidates consistently as well. Keeping this scoped to month tokens also avoids accidentally changing escaped literal matching.
Suggested regression table: 14Nov22, 14NOV22, and 14nov22 with DDMMMYY, all asserting year 2022, month 11, day 14; repeat with DDMMMYYYY and reject an unknown month. Asserting the full date catches the misleading fallback result.
I maintain DateParser Kotlin; its MIT English month grammar is a case-normalization reference, not a Python dependency. I haven't run Pendulum's tests.
Activity
tudopropaganda commentedon Apr 14, 2025
You should use strict=False
Alox1d commentedon Oct 15, 2026
The
strict=Falseexample above is not an equivalent workaround: it returns 2014-11-22, whereasDDMMMYYfor14nov22means 2022-11-14. That fallback goes through dateutil and its date-order preferences, rather than preserving the supplied format contract.The current formatter has two relevant layers:
_replace_tokens()builds case-sensitive month alternatives, andLocale.match_translation()performs an exact-value lookup. Making only the regex case-insensitive would leave the second layer unmatched; normalize the captured month and lookup candidates consistently as well. Keeping this scoped to month tokens also avoids accidentally changing escaped literal matching.Suggested regression table:
14Nov22,14NOV22, and14nov22withDDMMMYY, all asserting year 2022, month 11, day 14; repeat withDDMMMYYYYand reject an unknown month. Asserting the full date catches the misleading fallback result.I maintain DateParser Kotlin; its MIT English month grammar is a case-normalization reference, not a Python dependency. I haven't run Pendulum's tests.