Hackerman
Hackerman

Reputation: 1398

TimeZone in Tempus Dominus

I'm trying to use the TimeZone option in Bootstrap 4's Tempus Dominus (calendar) functionality. That option uses moment-timezone, of which I have already added the CDN.

My objective is to make the timezone EST (GMT-5), where right now it's guessing my local timezone which is ET (The data I'm parsing doesn't take EDT into account, so ET won't work right). How do I accomplish this? What parameter do I give the timeZone option below:

$('#datetimepicker1').datetimepicker({timeZone: /*...*/, format: "MM/DD/YY kk:mm", useCurrent: false, defaultDate: dataArr[3][0][0], minDate: dataArr[3][0][0], maxDate: dataArr[3][dataArr[3].length - 1][0]});

Upvotes: 1

Views: 2232

Answers (1)

Matt Johnson-Pint
Matt Johnson-Pint

Reputation: 241788

You should pass time zones from the IANA TZ Database. You can find a list of them on Wikipedia.

If you want your results to correctly reflect Eastern time in the US, then you must consider daylight saving time. Ignoring it means you will be an hour off for a large part of the year. Choose "America/New_York".

If on the other hand, you are certain that you want UTC-5, fixed for the entire year, regardless that this is not the time in the US Eastern time zone for much of the year, then pick "Etc/GMT+5". (Note the sign is inverted, due to following POSIX conventions.)

Upvotes: 2

Related Questions