Reputation: 159
On the console in chrome browser of windows and Ubuntu I entered Date()
object and I found both have a different way to write the timezone for that date.
Ubuntu: "Thu Aug 10 2017 18:45:18 GMT+0530 (IST)"
Windows: "Thu Aug 10 2017 18:45:18 GMT+0530 (India Standard Time)"
According to my use case the output on Ubuntu is correct, the time zone IST is what expected. But on windows it always shows up India Standard Time.
Is there a way to fix this for windows.
Upvotes: 0
Views: 235
Reputation: 1075079
According to my use case the output on Ubuntu is correct
Neither of them is correct. Or incorrect. The string form of a Date
from toString
(which is what those appear to be) is almost completely unspecified. The only requirement is that it represent the date, and that Date()
and Date.parse
should be able to parse it.
If you want something reliable cross browser*, use toISOString
.
* Obsolete browsers may not have toISOString
. Even only vaguely-modern browsers do.
Upvotes: 1