diff --git a/packages/@internationalized/date/src/DateFormatter.ts b/packages/@internationalized/date/src/DateFormatter.ts index 16d808864d3..21ab69f310e 100644 --- a/packages/@internationalized/date/src/DateFormatter.ts +++ b/packages/@internationalized/date/src/DateFormatter.ts @@ -12,10 +12,6 @@ let formatterCache = new Map(); -interface ResolvedDateTimeFormatOptions extends Intl.ResolvedDateTimeFormatOptions { - hourCycle?: Intl.DateTimeFormatOptions['hourCycle'] -} - interface DateRangeFormatPart extends Intl.DateTimeFormatPart { source: 'startRange' | 'endRange' | 'shared' } @@ -79,8 +75,8 @@ export class DateFormatter implements Intl.DateTimeFormat { } /** Returns the resolved formatting options based on the values passed to the constructor. */ - resolvedOptions(): ResolvedDateTimeFormatOptions { - let resolvedOptions = this.formatter.resolvedOptions() as ResolvedDateTimeFormatOptions; + resolvedOptions(): Intl.ResolvedDateTimeFormatOptions { + let resolvedOptions = this.formatter.resolvedOptions(); if (hasBuggyResolvedHourCycle()) { if (!this.resolvedHourCycle) { this.resolvedHourCycle = getResolvedHourCycle(resolvedOptions.locale, this.options); @@ -156,10 +152,10 @@ function hasBuggyHour12Behavior() { let _hasBuggyResolvedHourCycle: boolean | null = null; function hasBuggyResolvedHourCycle() { if (_hasBuggyResolvedHourCycle == null) { - _hasBuggyResolvedHourCycle = (new Intl.DateTimeFormat('fr', { + _hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', { hour: 'numeric', hour12: false - }).resolvedOptions() as ResolvedDateTimeFormatOptions).hourCycle === 'h12'; + }).resolvedOptions().hourCycle === 'h12'; } return _hasBuggyResolvedHourCycle; diff --git a/packages/@react-types/shared/src/dom.d.ts b/packages/@react-types/shared/src/dom.d.ts index 88fea2c1c13..d0d3fe03e5e 100644 --- a/packages/@react-types/shared/src/dom.d.ts +++ b/packages/@react-types/shared/src/dom.d.ts @@ -59,7 +59,7 @@ export interface DOMProps { /** * The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */ - id?: string + id?: string | undefined } export interface FocusableDOMProps extends DOMProps {