JS Built-ins
IntlDateTimeFormatintermediate

Format to parts

πŸ“– Usage Example
const parts = new Intl.DateTimeFormat('en-US').formatToParts(new Date());
// [{type:'month',value:'1'}, {type:'literal',value:'/'}, ...]

formatToParts() breaks the formatted date into labeled parts for custom rendering.

Use Intl.DateTimeFormat.formatToParts to get parts of a date.

πŸ’‘ Hints (1)
  • β€’ Use .formatToParts(date)