getDateTimeFormatOptions() function
Given a parsed ICU date/time formatter pattern, constructs a corresponding Intl.DateTimeFormat options structure.
Signature:
export declare function getDateTimeFormatOptions(tokens: DateToken[], onError: (type: DateFormatError['type'], message: string, token: DateToken) => void): Intl.DateTimeFormatOptions;
Parameters
Returns:
Intl.DateTimeFormatOptions
Example
import { getDateTimeFormatOptions, parseDateTokens } from '@messageformat/date-skeleton'
const tokens = parseDateTokens('GyMMMMdd', console.error)
getDateTimeFormatOptions(tokens, console.error)
{
era: 'short',
year: 'numeric',
month: 'long',
day: '2-digit'
}
