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 trying to get the startOfDay and endOfDay of IST (Indian Standard Time) in UTC, on a node app running on ubuntu server where timezone is set to UTC
asynconModuleInit(){constcurrentUtcTime=newDate();// Without date-fns-tzconststartOfDay1=startOfDay(currentUtcTime);// With date-fns-tzconstconvertedTime=utcToZonedTime(currentUtcTime,'Asia/Kolkata');conststartOfDay2=startOfDay(convertedTime);console.log('currentTime :',currentUtcTime);console.log(`startDate1 :`,startOfDay1);console.log(`startDate2 :`,startOfDay2);}
but the start date should be 2023-09-24T18:30:00.000Z. if i set my TZ='Asia/Kolkata' and run the node app, i do get 2023-09-24T18:30:00.000Z but my server runs on UTC.
Am i handling it the right way? can someone guide me here?
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 trying to get the
startOfDay
andendOfDay
of IST (Indian Standard Time) in UTC, on a node app running on ubuntu server where timezone is set toUTC
this is the result i get
but the start date should be
2023-09-24T18:30:00.000Z
. if i set myTZ='Asia/Kolkata'
and run the node app, i do get2023-09-24T18:30:00.000Z
but my server runs onUTC
.Am i handling it the right way? can someone guide me here?
Beta Was this translation helpful? Give feedback.
All reactions