Skip to content

Conversation

@devongovett
Copy link
Member

Closes #8017

Some additional segment types are now returned by Intl.DateTimeFormat#formatToParts, including 'yearName' and 'relatedYear'. These are mainly returned for the Chinese calendar (reference). Intl.DisplayNames does not accept these segment types as inputs causing a crash. In addition the rest of our code does not support these and treats them as non-editable. This PR maps these segments to known types to avoid the crash.

While we don't technically support the Chinese calendar in @internationalized/date and there is a bunch of other broken behavior at the moment, at least we don't crash on these segment types anymore.

@rspbot
Copy link

rspbot commented May 22, 2025

// Node seems to convert everything to lowercase...
const TYPE_MAPPING = {
dayperiod: 'dayPeriod'
// Node seems to convert everything to lowercase...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you trying on node 22? I'm not seeing the issue in my local node environment
Screenshot 2025-05-22 at 5 40 14 pm

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was there before. probably from some older version

@LFDanLu LFDanLu added this pull request to the merge queue May 23, 2025
Merged via the queue into main with commit 8f684df May 23, 2025
30 checks passed
@LFDanLu LFDanLu deleted the datepicker-segment-crash branch May 23, 2025 23:14
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.

Got invalid_argument RangeError with zh-CN-u-ca-chinese locale

4 participants