[fix] Date Formatter outputs Local Time instead of UTC#33
Merged
Conversation
Copilot created this pull request from a session on behalf of
TechQuery
May 1, 2026 02:15
View session
[optimize] update Upstream packages
There was a problem hiding this comment.
Pull request overview
This PR updates formatDate to format Date values using the runtime’s local wall-clock time (instead of UTC-derived components), and aligns project dependencies/versioning with the release.
Changes:
- Adjust
formatDateto offset the timestamp bygetTimezoneOffset()before extracting ISO components. - Update
Dateformatting tests to reflect the intended local-time output. - Bump package version and refresh dev dependency versions (plus lockfile updates).
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
source/date.ts |
Shifts the Date by timezone offset so .toJSON()-extracted fields represent local time. |
test/date.spec.ts |
Updates formatDate assertions (currently in a timezone-dependent way that needs correction). |
package.json |
Bumps package version and updates dev dependency ranges. |
pnpm-lock.yaml |
Updates lockfile to match dependency bumps and transitive updates. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
formatDatewas usingDate.toJSON()which always serializes to UTC, causing formatted output to differ from the runtime's local wall-clock time.Changes
source/date.ts: Shift the timestamp bygetTimezoneOffset()before calling.toJSON(), so the extracted components reflect local time:test/date.spec.ts: Replace UTC ISO string inputs (new Date('2020-01-23T00:00:00.000Z')) with local-time constructors (new Date(2020, 0, 23)) so assertions hold in any timezone.Human changes