📅  最后修改于: 2022-03-11 14:57:11.755000             🧑  作者: Mango
const dt = new Date('2017-12-12');
console.log(format(dt, 'YYYY-MM-DD'));
The above code logs 2017-12-11 in the US, but 2017-12-12 in India.
||||||||||||||||||====>
const dt = new Date('2017-12-11');
const dtDateOnly = new Date(dt.valueOf() + dt.getTimezoneOffset() * 60 * 1000);
console.log(format(dtDateOnly, 'YYYY-MM-DD')); // Always "2017-12-11"