Repository navigation
fix(offset): match GNU timezone behavior - #358
anastygnome wants to merge 2 commits into
Conversation
85189b2 to
1732393
Compare
Merging this PR will degrade performance by 6.2%3 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #358 +/- ##
==========================================
- Coverage 98.97% 98.92% -0.06%
==========================================
Files 21 21
Lines 4698 4839 +141
Branches 143 151 +8
==========================================
+ Hits 4650 4787 +137
- Misses 47 51 +4
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
0855927 to
c7366d4
Compare
c7366d4 to
7f366f6
Compare
|
@sylvestre can you check real quick |
|
thanks for looking into this! |
| match rel { | ||
| relative::Relative::Years(_) | ||
| | relative::Relative::Months(_) | ||
| | relative::Relative::Days(_) => date_relative.push(rel), |
There was a problem hiding this comment.
with a local named zone, months/years now skip the GNU day overflow done in the else branch
e.g. "2026-01-31 EST +1 month" in America/New_York
please add a test
| } | ||
| } else { | ||
| // Apply relative adjustments in their existing order. Calendar | ||
| // month/year grouping is handled by the separate relative-fix PR. |
There was a problem hiding this comment.
please don't reference another PR in a code comment, it will be stale
| t.second(), | ||
| t.subsec_nanosecond(), | ||
| )?; | ||
| let named_zone_is_local = self |
There was a problem hiding this comment.
matching_local_zone is computed here and again at 4d, and offset.name() 3 times
could be done once, no?
| .and_then(|offset| offset.name()) | ||
| .is_some() | ||
| { | ||
| if let Some(offset) = self.offset.as_ref() { |
There was a problem hiding this comment.
we already know offset is Some here, do we need this if let?
| // zone and then apply the remaining hour correction. | ||
| if !use_named_local_zone && !named_fixed_zone_applied { | ||
| if let Some(offset) = self.offset { | ||
| let (offset, hour_adjustment) = offset.normalize(); |
There was a problem hiding this comment.
why change the order here (to_zoned then hours)?
it changes the result for offsets > 24h, please add a test
| local: civil::DateTime, | ||
| name: &str, | ||
| ) -> Option<jiff::tz::TimeZone> { | ||
| // GNU's universal abbreviations always denote fixed UTC, even if the |
There was a problem hiding this comment.
this duplicates the names of the offset table
could it be a flag in Offset instead?
| #[case::acst("2026-07-10 12:00 ACST", "2026-07-10 12:00:00+09:30")] | ||
| #[case::acdt("2026-01-10 12:00 ACDT", "2026-01-10 12:00:00+10:30")] | ||
| #[case::awst("2026-01-10 12:00 AWST", "2026-01-10 12:00:00+08:00")] | ||
| fn test_australian_zone_abbreviation_offsets(#[case] input: &str, #[case] expected: &str) { |
There was a problem hiding this comment.
is 13:00 EDT what GNU date gives with TZ=America/New_York?
| "adt" => (true, 3, 0, false), | ||
| "a" => (false, 1, 0, true), | ||
| // Australian abbreviations accepted by GNU date. | ||
| "aest" => (false, 10, 0, true), |
There was a problem hiding this comment.
Please split that into two pr: the new abbreviations and the numeric offset changes are independent of the DST work
Summary