Parameters 부분 옵션 정리 참고: https://runebook.dev/ko/docs/javascript/global_objects/intl/datetimeformat/datetimeformat
2-1. format(date)
console.log(new Intl.DateTimeFormat('sr-RS', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }).format(new Date()));
=> уторак, 3. мај 2022. (세르비아 날짜 표현)
var a = [new Date(2012, 08), new Date(2012, 11), new Date(2012, 03)];
var dateTimeFormat = new Intl.DateTimeFormat('pt-BR', { year: 'numeric', month: 'long' });
var usingFormatMap = a.map(dateTimeFormat.format);
console.log(usingFormatMap);
=> (3) ['setembro de 2012', 'dezembro de 2012', 'abril de 2012']
0: "setembro de 2012"
1: "dezembro de 2012"
2: "abril de 2012"
2-2. formatToParts(date)
console.log(new Intl.DateTimeFormat('pt-BR', { year: 'numeric', month: 'long' }).formatToParts(new Date()));
=> (3) [{…}, {…}, {…}]
0: {type: 'month', value: 'maio'}
1: {type: 'literal', value: ' de '}
2: {type: 'year', value: '2022'}
Parameters 부분 옵션 정리 참고: https://runebook.dev/ko/docs/javascript/global_objects/intl/numberformat/numberformat
6-1. format(number)
console.log(new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR'}).format(3500));
=> 3.500,00 €
6-2. formatToParts(number)
console.log(new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR'}).formatToParts(3500));
=> (7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}]
0: {type: 'integer', value: '3'}
1: {type: 'group', value: '.'}
2: {type: 'integer', value: '500'}
3: {type: 'decimal', value: ','}
4: {type: 'fraction', value: '00'}
5: {type: 'literal', value: ' '}
6: {type: 'currency', value: '€'}
console.log(Intl.getCanonicalLocales('EN-US'));
// output: Array ["en-US"]
console.log(Intl.supportedValuesOf('currency'));
// output: Array ["AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", ...]