Repository navigation
Add TIMEZONE_ABBREVIATIONS setting to override abbreviation offsets - #1415
Merged
AdrianAtZyte merged 3 commits intoOct 21, 2026
Merged
Conversation
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1415 +/- ##
=======================================
Coverage 99.03% 99.03%
=======================================
Files 239 239
Lines 3838 3850 +12
=======================================
+ Hits 3801 3813 +12
Misses 37 37 β View full report in Codecov by Harness. π New features to boost your workflow:
|
AdrianAtZyte
marked this pull request as ready for review
September 23, 2026 11:31
serhii73
approved these changes
Oct 20, 2026
serhii73
left a comment
Collaborator
There was a problem hiding this comment.
Code review (claude code-review, at 795e974). The setting is opt-in, so default behaviour is unchanged and I found no regression. The points below come from reading the call sites, not from running them.
Non-blocking notes:
- Only the
date_parser.pyandfreshness_date_parser.pycall sites passsettings. Thepop_tz_offset_from_stringcalls indate.pyandlanguages/locale.pystill use the built-in offsets, so with an override such as IST = +05:30 and input10:00 +05:30 IST, the parser strips both tokens but theis_applicablecheck may not, which could leave a strayISTand makeparse()return None. A test of the redundant-offset dedup with an override would settle this. - The override is not used for
TIMEZONE/TO_TIMEZONE(get_timezone_from_tz_stringandapply_dateparser_timezoneread the table directly), soTO_TIMEZONE='IST'would still convert with the default offset. Either apply it there or document that it is not. - Validation accepts only exact upper-case keys, although abbreviations match case-insensitively (
{'ist': ...}is rejected). It requires adictwhile the annotation saysMapping, and it does not check that keys are strings. For a name that appears more than once in the table (e.g. IST), only the first entry is overridden. - The cache key is built from
f'{key}-{settings[key]}', so equal dicts in a different order create separate cache entries, and mutating the dict after the first parse leaves the cached parser with the old offsets. offset_ofis rebuilt as a closure on every call even when the setting is empty; resolving the overrides once would avoid that on the hot path.- Docs should state which names are valid, that unknown ones raise
SettingValidationError, that keys are case-sensitive, and whetherTIMEZONE/search_datesare affected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #683, fixes #580