0
  console.log(moment(foo).format());

gives me the output: 2021-10-11T00:00:00+02:00

  console.log(new Date(foo).toISOString());

gives me the output: 2021-10-10T22:00:00.000Z

What do I need to do in order to get output #2 to match output #1 that uses moment?

Harry
  • 93
  • 9
  • 3
    The first output has a _timezone_, the latter is in UTC (as `toISOString` [always is](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)). They're the same point in time. – jonrsharpe Oct 04 '21 at 13:40
  • moment also has `toISOString`. See [As ISO 8601 String](https://momentjs.com/docs/#/displaying/as-iso-string/) – alpakyol Oct 04 '21 at 14:41

0 Answers0