CRAFT-1636: DateTimeField not display the correct current month view.#3153
Merged
misama-ct merged 3 commits intoJul 8, 2025
Conversation
…nctions with tests for edge cases
…t optional timezone parameter for improved date display
🦋 Changeset detectedLatest commit: 56411a6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 98 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
valoriecarli
approved these changes
Jul 8, 2025
ByronDWall
approved these changes
Jul 8, 2025
Contributor
ByronDWall
left a comment
There was a problem hiding this comment.
Thanks for fixing this!
ddouglasz
approved these changes
Jul 8, 2025
Merged
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.
Fix DateTimeField Calendar Display for Edge Case Timezones
🐛 Problem
The DateTimeField component was not displaying the correct current month and year when using timezones that are significantly ahead of UTC, particularly on the first day of any month. This occurred because the calendar header functions (
getMonthCalendarLabelandgetYearCalendarLabel) were interpreting dates in UTC context rather than the specified timezone.Example Issue:
🔧 Solution
Enhanced the
getMonthCalendarLabelandgetYearCalendarLabelfunctions in@commercetools-uikit/calendar-time-utilsto accept an optional timezone parameter. When provided, these functions now usemoment.tz()to interpret dates in the specified timezone context.📋 Changes Made
packages/calendar-time-utils/src/calendar-time.tsgetMonthCalendarLabelto accept optionaltimeZoneparametergetYearCalendarLabelto accept optionaltimeZoneparameterpackages/components/inputs/date-time-input/src/date-time-input.tsxCalendarHeadercomponent to passthis.props.timeZoneto both label functionsTest Coverage
🧪 Test Cases Added
Timezone Edge Cases:
🎯 Impact
📚 Before/After Example
🚀 Testing
Closes: CRAFT-1636
Type: Bug Fix
Packages:
@commercetools-uikit/calendar-time-utils,@commercetools-uikit/date-time-input