I need to convert a Date string to date
object in javascript. What I receive is something like:
utc='2021-02-03T02:44:51.118Z'. # time in utc
local='2021-02-03T12:44:51.118Z' # time in local timezone
for above two strings, each of which represent a different timezone. How can I create a Date object from them to represent the right timezone? Ideally I'd like to convert them to epoch
format but don't know how to calculate offset correctly.
I have looked at getTimezoneOffset
method but it doesn't consider daylight saving time.