Skip to content
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

Daylight Saving Time (DST) support #59 #62

Merged
merged 30 commits into from
Oct 25, 2024
Merged

Daylight Saving Time (DST) support #59 #62

merged 30 commits into from
Oct 25, 2024

Conversation

jnd-au
Copy link
Contributor

@jnd-au jnd-au commented Oct 14, 2024

This PR adds DST support and Unit Tests to contribute significantly toward a tz v1.0.0 release. It fixes pre-existing issues up to v0.7.0 (@oz) plus it fixes new unreleased regressions in HEAD (@wyne). Until now, tz has never properly supported DST transitions.

This PR includes the following fixes:

  1. Support missing and duplicated DST hours, same as real-world clocks (fix 092a39a, fix Daylight Saving Time (DST) transition days aren’t correctly supported #59)
  2. Support dynamic timezone name abbreviations for daylight-saving transitions e.g. CET versus CEST (fix 0bdd6e2, fix Daylight Saving Time (DST) transition days aren’t correctly supported #59)
  3. Support correct DST date markers, including for midnight DST changes (fix 01ff381, fix Daylight Saving Time (DST) transition days aren’t correctly supported #59)
  4. Support fractional-hour timezone offsets and stable keyboard navigation (fix cb3ba9f, fix Regression: Erratic left/right intra-day hours navigation: Affects partial hours and DST support #60)
  5. Do not zero out the minutes during keyboard navigation, unless requested by the user (fix cb3ba9f, Regression: Erratic left/right intra-day hours navigation: Affects partial hours and DST support #60)
  6. Show -list search syntax (fix d6c5408)
  7. Unblock unit tests by making the time and zone properly settable, not dependent on the current time or user environment (fix 0bdd6e2, fix Regression: Loss of timezone preservation: Wrong tz abbreviations, plus unit-test blocker #57)
  8. Extensive unit-test coverage >80% with 95-100% coverage for most files, except main.go (fix Unit tests: Instability and lack of coverage #56)

Due to the extensive refactoring of core tz logic, this PR is quite ‘big’ so I’ve sub-divided it into small commits that are more easily reviewable. I’ve added baseline unit test data from v0.7.0, then incrementally updated it to show the impact and necessity of each change.

This PR includes the following new features to make DST clearer:

  1. Show DST start & end markers
  2. Show numerical UTC offset for timezones (z key)
    • This helps resolve user confusion about timezone names, as the “ST” abbreviation is ambiguous and can either mean “Standard Time” (no daylight saving) or “Summer Time” (with daylight saving).
  3. Show ISO datetime format (f key)
  4. Highlight a particular timezone in the output (j/k keys)
  5. Keyboard navigation to add/subtract one minute at a time (-/+ keys)

This PR depends on first merging PRs #54 and #61 (commits on 9 and 13 October), as they contain pre-requisite fixes as a basis for the functionality and unit-test data/expectations in this PR. Hence I’ve raised this as a Draft for the time being, although it’s ready for review (commits starting 14 October).

main.go Outdated Show resolved Hide resolved
jnd-au added 26 commits October 25, 2024 15:14
…es, fix 092a39a) and +/-/0 keys for minute navigation (fix cb3ba9f)
@jnd-au jnd-au marked this pull request as ready for review October 25, 2024 04:19
@oz
Copy link
Owner

oz commented Oct 25, 2024

Thank you! 🙌🏻

@oz oz merged commit 5ae5e74 into oz:main Oct 25, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment