fix(@formatjs/intl-datetimeformat): add synthetic range, fix #4535#5682
Closed
fix(@formatjs/intl-datetimeformat): add synthetic range, fix #4535#5682
Conversation
Member
Author
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Merge activity
|
graphite-app bot
pushed a commit
that referenced
this pull request
Dec 26, 2025
…5682) ### TL;DR Fixed date range formatting to avoid duplicating dates when formatting time ranges on the same day. ### What changed? - Enhanced the date extraction script to properly handle interval formats according to the TR35 specification - Added support for synthesizing interval formats for combined date+time skeletons - Implemented logic to use time interval patterns with date patterns when formatting ranges on the same day - Added test case for issue #4535 to verify the fix works correctly ### How to test? Run the new test case that verifies a date range on the same day with different times: ```javascript const dtf = new DateTimeFormat('en-GB', { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric', }); // Same day (Sept 22, 2024), different times (14:00 to 16:00) const result = dtf.formatRange( new Date('2024-09-22T14:00:00'), new Date('2024-09-22T16:00:00') ); // Should output: "Sun, 22 Sept 2024, 14:00–16:00" (date appears only once) ``` ### Why make this change? Fixes issue #4535 where date ranges on the same day would incorrectly duplicate the date information. This improves readability by following the CLDR standard for interval formatting, which specifies that when formatting a time range on the same day, the date should only appear once. The implementation now correctly follows the TR35 specification for interval formats.
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.

TL;DR
Fixed date range formatting to avoid duplicating dates when formatting time ranges on the same day.
What changed?
FormattedDateTimeRangein React Native #4535 to verify the fix works correctlyHow to test?
Run the new test case that verifies a date range on the same day with different times:
Why make this change?
Fixes issue #4535 where date ranges on the same day would incorrectly duplicate the date information. This improves readability by following the CLDR standard for interval formatting, which specifies that when formatting a time range on the same day, the date should only appear once. The implementation now correctly follows the TR35 specification for interval formats.