Skip to content

Craft 2104 | ensure localized date time format strings display the correct format for the locale#3218

Merged
ByronDWall merged 2 commits into
mainfrom
CRAFT-2104-localize-format-pattern
Feb 10, 2026
Merged

Craft 2104 | ensure localized date time format strings display the correct format for the locale#3218
ByronDWall merged 2 commits into
mainfrom
CRAFT-2104-localize-format-pattern

Conversation

@ByronDWall
Copy link
Copy Markdown
Contributor

@ByronDWall ByronDWall commented Feb 10, 2026

This pull request updates the getLocalizedDateTimeFormatPattern utility to generate localized date and time format strings using the native Intl.DateTimeFormat.formatToParts API instead of relying on moment.js. This change improves accuracy for locales not covered by moment.js, reduces external dependencies, and modernizes the codebase. It also updates related tests and documentation to reflect this new approach.

Related to this app-kit update

Core logic changes:

  • Replaced moment.js-based locale format extraction in getLocalizedDateTimeFormatPattern with new functions (getIntlDatePattern and getIntlTimePattern) that use Intl.DateTimeFormat.formatToParts for constructing localized date and time patterns. (packages/calendar-time-utils/src/calendar-time.ts) [1] [2]
  • Updated fallback and comments to clarify that the pattern now comes from Intl rather than moment.js. (packages/calendar-time-utils/src/calendar-time.ts)

Testing and coverage:

  • Expanded test cases in calendar-time.spec.js to include locales not supported by moment.js (e.g., en-BE, en-GU) and verify correct pattern generation with the new implementation. (packages/calendar-time-utils/src/calendar-time.spec.js) [1] [2] [3]

Documentation and release notes:

  • Added a changeset documenting the switch from moment.js to Intl.DateTimeFormat.formatToParts for localized format generation. (.changeset/nine-dolls-press.md)

…tToParts to generate localized date and time format description strings instead of relying on moment.js locale descriptions functions, since moment.js does not include format informations for many english locales and falls back to en which uses US mm/dd/yyyy formatting, which is incorrect as the vast majority of en locales use dd/mm/yyyy formatting. Add test for en-be formatting description to ensure that locales moment uses a fallback for are now displaying the correct format string
…re that us-formatted en locales return correctly
@ByronDWall ByronDWall requested a review from a team February 10, 2026 16:14
@ByronDWall ByronDWall self-assigned this Feb 10, 2026
@ByronDWall ByronDWall removed the request for review from a team February 10, 2026 16:14
@ByronDWall ByronDWall requested a review from a team as a code owner February 10, 2026 16:14
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 10, 2026

🦋 Changeset detected

Latest commit: fe32223

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 98 packages
Name Type
@commercetools-uikit/calendar-time-utils Patch
@commercetools-uikit/date-input Patch
@commercetools-uikit/date-range-input Patch
@commercetools-uikit/date-time-input Patch
@commercetools-uikit/date-field Patch
@commercetools-uikit/inputs Patch
@commercetools-uikit/date-range-field Patch
@commercetools-uikit/date-time-field Patch
@commercetools-uikit/fields Patch
@commercetools-frontend/ui-kit Patch
@commercetools-uikit/design-system Patch
@commercetools-uikit/calendar-utils Patch
@commercetools-uikit/hooks Patch
@commercetools-uikit/i18n Patch
@commercetools-uikit/localized-utils Patch
@commercetools-uikit/utils Patch
@commercetools-uikit/accessible-hidden Patch
@commercetools-uikit/avatar Patch
@commercetools-uikit/card Patch
@commercetools-uikit/collapsible-motion Patch
@commercetools-uikit/collapsible-panel Patch
@commercetools-uikit/collapsible Patch
@commercetools-uikit/constraints Patch
@commercetools-uikit/data-table-manager Patch
@commercetools-uikit/data-table Patch
@commercetools-uikit/field-errors Patch
@commercetools-uikit/field-label Patch
@commercetools-uikit/field-warnings Patch
@commercetools-uikit/filters Patch
@commercetools-uikit/grid Patch
@commercetools-uikit/icons Patch
@commercetools-uikit/label Patch
@commercetools-uikit/link Patch
@commercetools-uikit/loading-spinner Patch
@commercetools-uikit/messages Patch
@commercetools-uikit/notifications Patch
@commercetools-uikit/pagination Patch
@commercetools-uikit/primary-action-dropdown Patch
@commercetools-uikit/progress-bar Patch
@commercetools-uikit/quick-filters Patch
@commercetools-uikit/stamp Patch
@commercetools-uikit/tag Patch
@commercetools-uikit/text Patch
@commercetools-uikit/tooltip Patch
@commercetools-uikit/view-switcher Patch
@commercetools-uikit/accessible-button Patch
@commercetools-uikit/flat-button Patch
@commercetools-uikit/icon-button Patch
@commercetools-uikit/link-button Patch
@commercetools-uikit/primary-button Patch
@commercetools-uikit/secondary-button Patch
@commercetools-uikit/secondary-icon-button Patch
@commercetools-uikit/dropdown-menu Patch
@commercetools-uikit/async-creatable-select-field Patch
@commercetools-uikit/async-select-field Patch
@commercetools-uikit/creatable-select-field Patch
@commercetools-uikit/localized-multiline-text-field Patch
@commercetools-uikit/localized-text-field Patch
@commercetools-uikit/money-field Patch
@commercetools-uikit/multiline-text-field Patch
@commercetools-uikit/number-field Patch
@commercetools-uikit/password-field Patch
@commercetools-uikit/radio-field Patch
@commercetools-uikit/search-select-field Patch
@commercetools-uikit/select-field Patch
@commercetools-uikit/text-field Patch
@commercetools-uikit/time-field Patch
@commercetools-uikit/async-creatable-select-input Patch
@commercetools-uikit/async-select-input Patch
@commercetools-uikit/checkbox-input Patch
@commercetools-uikit/creatable-select-input Patch
@commercetools-uikit/input-utils Patch
@commercetools-uikit/localized-money-input Patch
@commercetools-uikit/localized-multiline-text-input Patch
@commercetools-uikit/localized-rich-text-input Patch
@commercetools-uikit/localized-text-input Patch
@commercetools-uikit/money-input Patch
@commercetools-uikit/multiline-text-input Patch
@commercetools-uikit/number-input Patch
@commercetools-uikit/password-input Patch
@commercetools-uikit/radio-input Patch
@commercetools-uikit/rich-text-input Patch
@commercetools-uikit/rich-text-utils Patch
@commercetools-uikit/search-select-input Patch
@commercetools-uikit/search-text-input Patch
@commercetools-uikit/select-input Patch
@commercetools-uikit/select-utils Patch
@commercetools-uikit/selectable-search-input Patch
@commercetools-uikit/text-input Patch
@commercetools-uikit/time-input Patch
@commercetools-uikit/toggle-input Patch
@commercetools-uikit/spacings-inline Patch
@commercetools-uikit/spacings-inset-squish Patch
@commercetools-uikit/spacings-inset Patch
@commercetools-uikit/spacings-stack Patch
@commercetools-uikit/buttons Patch
@commercetools-uikit/spacings Patch
visual-testing-app Patch

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

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ui-kit Ready Ready Preview, Comment Feb 10, 2026 4:14pm

Request Review

@ByronDWall
Copy link
Copy Markdown
Contributor Author

[preview_deployment]

@ByronDWall ByronDWall merged commit 0adb176 into main Feb 10, 2026
9 checks passed
@ByronDWall ByronDWall deleted the CRAFT-2104-localize-format-pattern branch February 10, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants