0

Within our application we are trying to pass through a users selected datetime of which is causing issues within different browsers. As an example, running the below in both Chrome, and Safari both output a different time. Chrome honours the BST and yet safari does not

new Date('2020-08-11T11:47:00').toJSON()

Have tried to google, but unable to find any specific examples for this.

Are there any solutions in place to get around this issue?

EDIT

Chrome output :- "2020-08-11T10:47:00.000Z"

Safari output :- "2020-08-11T11:47:00.000Z"

Simon
  • 1,412
  • 4
  • 20
  • 48

1 Answers1

0

Safari's parser is buggy. '2020-08-11T11:47:00' should be parsed as local, but Safari (up to v 13.1.2 at least) treats it as UTC. Don't use the built–in parser, see Why does Date.parse give incorrect results?

RobG
  • 142,382
  • 31
  • 172
  • 209