> new Date("2020-01-08T19:47:00.000Z")
Wed Jan 08 2020 14:47:00 GMT-0500 (Eastern Standard Time)
// using moment.js
> moment("2020-01-08T19:47:00.000Z").format("h:mm a MMM DD, YYYY")
"2:47 pm Jan 08, 2020"
// using date-fns
> format(parseISO("2020-01-08T19:47:00.000Z"), "h:mm a MMM dd, yyyy")
"2:47 PM Jan 08, 2020"
> new Date("2020-01-08T19:47:00.000Z")
Wed Jan 08 2020 20:47:00 GMT+0100 (Central European Standard Time)
// using moment.js
> moment("2020-01-08T19:47:00.000Z").format("h:mm a MMM DD, YYYY")
"8:47 pm Jan 08, 2020"
// using date-fns
> format(parseISO("2020-01-08T19:47:00.000Z"), "h:mm a MMM dd, yyyy")
"8:47 PM Jan 08, 2020"
> "Steve thinks 4:30 is too early"
"Steve thinks 4:30 is too early"
> moment.localizeThisSomehow("Steve thinks 4:30 is too early")
Uncaught TypeError: moment.localizeThisSomehow is not a function
console.log(new Date("2020-01-01").toString());
// -> Tue Dec 31 2019 19:00:00 GMT-0500 (Eastern Standard Time)console.log(format(new Date("2020-01-01"), "MMMM do yyyy"));
// -> December 31st 2019// moment magically fixes this problem for you
console.log(moment("2020-01-01").format("MMMM Do YYYY"));
// -> January 1st 2020// ... unless you invoke with a date and not a string
console.log(moment(new Date("2020-01-01")).format("MMMM Do YYYY"));
// -> December 31st 2019console.log(new Date("2020-01-01").toISOString());
// -> 2020-01-01T00:00:00.000Z
console.log(new Date("2020-01-01").toString());
// -> Tue Dec 31 2019 19:00:00 GMT-0500 (Eastern Standard Time)