⬅︎ Back to Be careful with Date.toLocaleDateString() in JavaScript
What happens if you print the timezone? Do you get a different value on your laptop than on your server?new Date('2014-11-27T02:50:49Z').toLocaleDateString('en', { 'day': 'numeric', 'timeZoneName': 'short' })
> new Date('2014-11-27T02:50:49Z').toLocaleDateString('en', { 'day': 'numeric', 'timeZoneName': 'short' })'27, UTC'I did not know about `timeZoneName`. Thanks for the tip!
Comment
What happens if you print the timezone? Do you get a different value on your laptop than on your server?
new Date('2014-11-27T02:50:49Z').toLocaleDateString('en', { 'day': 'numeric', 'timeZoneName': 'short' })
Replies
> new Date('2014-11-27T02:50:49Z').toLocaleDateString('en', { 'day': 'numeric', 'timeZoneName': 'short' })
'27, UTC'
I did not know about `timeZoneName`. Thanks for the tip!