Closed stealthrabbi closed 2 years ago
The browser by default doesn't support a different timezone if you are not in that timezone. So for example, If u are in the CES timezone and want to switch to EST, you will not be able to do it via javascript. You can only get offset in the time. However, the Date
object will show your current time zone.
The answer to your solution is to manipulate dates before or after it comes to the date picker.
I had in plan to add timezone support, but keep in mind, that the date object will always be in the timezone where the client is, only the time offset will be set.
Thank you for your update.
What does the change made for this actually do, if the returned date object is still in local time? Does the new setting impact the default time to be UTC?
@stealthrabbi When enabled, the string will be returned, since you can't have a date object in a different timezone, however, the returned string is in the UTC offset from the current time zone.
For example, my timezone is UTC+1, if I select let's say 22:33, the time in the returned string will be 21:33.
Thank you for the explanation. What I was hoping to hae would be for a way for the user to enter the time in UTC, and have the date object returned be in UTC (without manipulation of the user's entry). It seems that that may not be possible though given browser limitations.
Hmm, in that case, you wouldn't need the UTC, if it is the same date, you can always just do a Date.toISOString()
There doesn't seem to be a way to specify a timezone. I want to use this and have all datetimes always be in a particular zone (UTC), but the formatting seems to always be in UTC. Is there a way I can force everything UTC?