Skip to main content

[WebAPIs] Intl API

keywords: Intl, Intl.ListFormat, Intl.DateTimeFormat, Intl.NumberFormat#
// Intl.NumberFormat
new Intl.NumberFormat('en').format(1000); // 1,000
// Intl.DataTimeFormat
function ISOtoLongDate(isoString, locale = 'en-US') {
const options = { month: 'long', day: 'numeric', year: 'numeric' };
const date = new Date(isoString);
const longDate = new Intl.DateTimeFormat(locale, options).format(date);
return longDate;
}
Last updated on