import requiredArgs from '../_lib/requiredArgs/index' ; type Locale = Intl . ResolvedDateTimeFormatOptions [ 'locale' ] ; type FormatOptions = Intl . DateTimeFormatOptions ; type LocaleOptions = { locale : Locale | Locale [ ] ; } ; export default function intlFormat ( date ) ; export default function intlFormat ( date , localeOptions ) ; export default function intlFormat ( date , formatOptions ) ; export default function intlFormat ( date , formatOptions , localeOptions ) ; name category summary description param { Date | Number } argument param formatOptions param { 'lookup' | 'best fit' } formatOptions . localeMatcher param { 'narrow' | 'short' | 'long' } formatOptions . weekday param { 'narrow' | 'short' | 'long' } formatOptions . era param { 'numeric' | '2-digit' } formatOptions . year param { 'numeric' | '2-digit' | 'narrow' | 'short' | 'long' } formatOptions . month param { 'numeric' | '2-digit' } formatOptions . day param { 'numeric' | '2-digit' } formatOptions . hour param { 'numeric' | '2-digit' } formatOptions . minute param { 'numeric' | '2-digit' } formatOptions . second param { 'short' | 'long' } formatOptions . timeZoneName param { 'basic' | 'best fit' } formatOptions . formatMatcher param { Boolean } formatOptions . hour12 param { String } formatOptions . timeZone param localeOptions param { String | String [ ] } localeOptions . locale returns { String } throws throws example example example example export default function intlFormat ( date , formatOrLocale ? , localeOptions ? ) { requiredArgs ( 1 , arguments ) ; let formatOptions ; if ( isFormatOptions ( formatOrLocale ) ) { formatOptions = formatOrLocale ; } else { localeOptions = formatOrLocale ; } return new Intl . DateTimeFormat ( localeOptions ?. locale , formatOptions ) . format ( date ) ; } function isFormatOptions ( opts ) { return opts !== undefined && ! ( 'locale' in opts ) ; }