Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1618,11 +1618,14 @@ describe('DatePicker', function () {
});

it('should support typing into the era segment', function () {
let formatter = new Intl.DateTimeFormat('en-US-u-ca-ethiopic', {year: 'numeric', era: 'narrow', timeZone: 'UTC'});
let era0 = formatter.formatToParts(0).find(p => p.type === 'era').value;

testInput('era,', new CalendarDate(new JapaneseCalendar(), 'reiwa', 5, 2, 3), 'h', new CalendarDate(new JapaneseCalendar(), 'heisei', 5, 2, 3), false, {locale: 'en-US-u-ca-japanese'});
testInput('era,', new CalendarDate(new JapaneseCalendar(), 'reiwa', 5, 2, 3), 's', new CalendarDate(new JapaneseCalendar(), 'showa', 5, 2, 3), false, {locale: 'en-US-u-ca-japanese'});
testInput('era,', new CalendarDate(new JapaneseCalendar(), 'showa', 5, 2, 3), 'r', new CalendarDate(new JapaneseCalendar(), 'reiwa', 5, 2, 3), false, {locale: 'en-US-u-ca-japanese'});
testInput('era,', new CalendarDate(new EthiopicCalendar(), 'AM', 2012, 2, 3), '0', new CalendarDate(new EthiopicCalendar(), 'AA', 2012, 2, 3), false, {locale: 'en-US-u-ca-ethiopic'});
testInput('era,', new CalendarDate(new EthiopicCalendar(), 'AA', 2012, 2, 3), '1', new CalendarDate(new EthiopicCalendar(), 'AM', 2012, 2, 3), false, {locale: 'en-US-u-ca-ethiopic'});
testInput('era,', new CalendarDate(new EthiopicCalendar(), 'AM', 2012, 2, 3), era0 === 'AM' ? 'A' : '0', new CalendarDate(new EthiopicCalendar(), 'AA', 2012, 2, 3), false, {locale: 'en-US-u-ca-ethiopic'});
testInput('era,', new CalendarDate(new EthiopicCalendar(), 'AA', 2012, 2, 3), era0 === 'AM' ? 'M' : '1', new CalendarDate(new EthiopicCalendar(), 'AM', 2012, 2, 3), false, {locale: 'en-US-u-ca-ethiopic'});
});

it('should allow entering invalid dates, and constrain on blur', async function () {
Expand Down
5 changes: 5 additions & 0 deletions packages/@internationalized/number/src/NumberParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ class NumberParserImpl {
value = replaceAll(value, "'", this.symbols.group);
}

// On newer ICU versions, the special single quote has been normalized, so we need to backport.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure I understand why this change is needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

See #9887 (comment) - apparently de-CH doesn't always resolve to the special group character, thereby causing the test for it to fail as NaN is parsed.

if (this.symbols.group === "'" && value.includes('’') && isGroupSymbolAllowed) {
value = replaceAll(value, '’', this.symbols.group);
}

// fr-FR group character is narrow non-breaking space, char code 8239 (U+202F), but that's not a key on the french keyboard,
// so allow space and non-breaking space as a group char as well
if (this.options.locale === 'fr-FR' && this.symbols.group && isGroupSymbolAllowed) {
Expand Down
Loading