js处理数值和日期本地化

js处理数值和日期本地化

const s = new Intl.NumberFormat('zh-cn');
s.format(111.111) // "111.111"

const s = new Intl.NumberFormat('zh-cn', {style: 'currency', currency: 'CNY'});
s.format(111.111) // "¥111.11"

const s = new Intl.DateTimeFormat('zh-cn');
s.format(new Date()); // "2019/2/5"
原文地址:https://www.cnblogs.com/ye-hcj/p/10353042.html