how to get time zone difference date-fns
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"