fix: timezone & offset issues - #9
Merged
Merged
Conversation
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.
This pull request introduces several improvements and optimizations to the Chronos TypeScript date/time library, with a focus on more accurate timezone handling, improved parsing logic, and performance optimizations. The most significant changes are in how dates are parsed and compared in the presence of timezones, as well as the introduction of a formatter cache to reduce overhead in timezone calculations. Minor code cleanups and comment removals were also made for clarity.
Timezone and Parsing Improvements
Chronos, ensuring they are resolved in the correct timezone and rejecting invalid dates more robustly. This prevents silent fallback to the process timezone and ensures accurate wall-clock interpretation.isBefore,isAfter,isSame,isBetween,diff, etc.) now consistently use the instance's timezone for both operands, ensuring correct results when timezones are involved. This includes a newunitStarthelper and logic for calendar unit differences. [1] [2] [3] [4] [5] [6]Performance Optimizations
Intl.DateTimeFormatinstances intimezone.ts, significantly reducing the performance cost of repeated zone-aware date formatting and offset calculations. [1] [2] [3]Code Cleanup and Maintenance
ChronosPeriodandChronosPeriodCollectionfor better readability and maintainability. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Package and Export Adjustments
2.0.5and removed thepostpublishscript frompackage.json. [1] [2]index.tsandlocales/index.ts. [1] [2]