Welcome to this episode. Another time zone question :
I did a small part of reading on SO, tried to manipulate moment.js and date.js to help me, and overall I was tormented by the feeling of frustration since I started trying to solve this problem, so if someone could help or point to me on a duplicate question about SO that I just could not find, that would be awesome.
I have a page. This page is displayed several times, for example: 7:28, 7:38, 7:48. I know this is AM / PM. These times are always America / New York (they do not change when daylight saving time changes, since the event that they correspond always occurs at this time, regardless of DST). Let me call them a schedule. I want to highlight the time that will come next.
- This is trivial for people living in America / New York.
- It's not too scary for people living in America / Los Angeles (assuming my logic works).
- I can take the current computer time in America / Los Angeles, convert it to UTC, and then determine whether America / Los Angeles is currently watching DST or not, and determine whether America / New York should be -0400 or -0500, apply this to UTC and do my comparison. This is a little painful, because you still always have a date based in America / Los Angeles, and you donβt actually change the time zone of the Date object, but I do have a reliable way to tilt (or forward) the clock from UTC time.
What happens, however, when I try to determine if daylight saving time is respected from a computer in a region where daylight saving is not observed at all?
JavaScript will only create Date objects for the current time zone, as far as I know, and then any DST definition is based on that Date object.
I just don't care? Times are primarily relevant only to people living in America / New York. I'm just trying to create an application that makes sense when viewed from a different time zone, so when it is 3AM in country_without_DST and its 2PM in America / New York, the βgraphβ emphasizes that the 2:05 PM thing should happen and not 3 : 05 a.m.
source share