I've seen lots of questions around on how to convert from local to UTC string, but i'm in need of something "deeper".
I need to have my date object (new Date()
) converted to UTC -8.
The problem here is that i could probably use setHours
after using Date.UTC
, but that would totally break when, for example, the user is on UTC -8.
I've tried looking at moment, but i'm not seeing anything that could help.
Any tips?
Update: Explanation on why i need this -> I'm making a REST API call to a SharePoint site which is set to UTC -8. The API does not calculate what i'm sending it so if i send it a datetime object with lets say April 19 2019 it will actually set April 18 2019 (because it is setting it as 12 A.M. and the time difference messes it up).
I have people from different timezones that will be using that app which is why i need something that doesnt setHours based on local time.