You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm struggling to display a time from server and ignore the client's local timezone.
From my server I'm getting back a datetime in the string of "2022-06-07T16:00:00.000-07:00"" . Which right now is 4 PM pacific daylight savings time.
I'm currently using date-fns to parse that string to date via
let date = parse(time, "yyyy-MM-dd'T'HH:mm:ss.SSSxxx", new Date())
The client device is currently in central time.
My issue is the date is displaying at 6pm , which is correct for central time. But I want to display the original 4pm value, essentially ignore client's timezone).
I'm unclear how to do this, other than just string manipulation of removing the -07:00. Is there a better way to solve this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm struggling to display a time from server and ignore the client's local timezone.
From my server I'm getting back a datetime in the string of "2022-06-07T16:00:00.000-07:00"" . Which right now is 4 PM pacific daylight savings time.
I'm currently using date-fns to parse that string to date via
let date = parse(time, "yyyy-MM-dd'T'HH:mm:ss.SSSxxx", new Date())
The client device is currently in central time.
My issue is the date is displaying at 6pm , which is correct for central time. But I want to display the original 4pm value, essentially ignore client's timezone).
I'm unclear how to do this, other than just string manipulation of removing the -07:00. Is there a better way to solve this?
Beta Was this translation helpful? Give feedback.
All reactions