parseDateTokens() function
Parse an ICU DateFormat skeleton string into a DateToken array.
Signature:
export declare function parseDateTokens(src: string): DateToken[];
Parameters
Parameter | Type | Description |
---|---|---|
src | string | The skeleton string |
Returns:
Remarks
Errors will not be thrown, but if encountered are included as an { error }
token.
Example
import { parseDateTokens } from '@messageformat/date-skeleton'
parseDateTokens('GrMMMdd', console.error)
// [
// { char: 'G', width: 1 },
// { char: 'r', width: 1 },
// { char: 'M', width: 3 },
// { char: 'd', width: 2 }
// ]