I'm storing a schedule start time UTC, with the following information, Start hour, start minute and the day it is to trigger on. The issue I'm having is if I set a start time for 9AM, then I want 9AM to be shown all year, but I've noticed if DST comes into effect this isn't the case and I might see 8AM. Using Javascript, is there anyway I could ensure the correct time is shown regardless of DST? Would I need to store more information other than what I have mentioned above, to do this?
I've been playing around with the getTimezoneOffset() which returns the difference in minutes between local time and UTC, to see if I can offset correctly but having no luck, so wondering what is a recommeded implementation for this kind of scenario. I think Outlook stores the time zone along with it's scheduled time, so I'm thinking is that what I need to do.
question from:
https://stackoverflow.com/questions/65922902/displaying-correct-time-when-in-dst-or-not 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…