I am trying to get a datetimeoffset object from UX to backend api in asp.net core 3.0 hosted on Azure web app.
My model has a datetimeoffset property (lets say ETA). In UX I have a date picker where user can select the date. Once submitted the date will be passed as part of the api body like below
And my model in web api looks like this
All I am doing is saving the date in sql server as a datetimeoffset field. While running locally the updated value in sql is correct like '2020-05-06 00:00:00.0000000 -07:00', while my local machine is in PST. But the moment I deploy to Azure, as its by default treats everything in UTC I believe, the date being saved in DB is '2020-05-06 00:00:00.0000000 +00:00', which is not what I want, I want to save the correct timezone info being sent as part of the api call. My target is users can select eta from around the world, what I need is to save the date along with the correct timezone in sql as datetimeoffset so that all my datetimeoffset compare works fine in backend. Just to add, user is passing a date only but in backend I set the time to 23:59:59 to make the EOD field as true end of day of that specific timezone.
I saw the "WEBSITE_TIME_ZONE" settings but we should not be using it ideally as we have uses all over and app is multi region.
What am I missing here, any direction will be helpful. The api uses the new System.Text.Json library for .net core 3.0. No Newtonsoft.Json library in between. My startup.cs file is default comes with .net core 3.0 template in VS.