Skip to content

Instantly share code, notes, and snippets.

@delebedev
Created May 28, 2019 15:48
Show Gist options
  • Save delebedev/5e8283f293ccecdca832e395cfce37be to your computer and use it in GitHub Desktop.
Save delebedev/5e8283f293ccecdca832e395cfce37be to your computer and use it in GitHub Desktop.
javascript hits again

Javascript is fun

a = new Date('2019-03-31T00:00:00.000Z');
a.setDate(a.getDate() + 1);
console.log(a);
Firefox macos Safari macos chrome macos
2019-03-31T23:00:00.000Z Mon Apr 01 2019 00:00:00 GMT+0100 (BST) Mon Apr 01 2019 00:00:00 GMT+0100 (British Summer Time)

however,

a = new Date('2019-03-31T00:00:00.000Z');
b = new Date(a.getTime()+1000*60*60*24);
console.log(b);
Firefox macos Safari macos chrome macos
2019-04-01T00:00:00.000Z Mon Apr 01 2019 01:00:00 GMT+0100 (BST) Mon Apr 01 2019 01:00:00 GMT+0100 (British Summer Time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment