I receive the following date from the server:
"2018-11-21 07:00:00 UTC"
Then, I convert it using userTimzone
variable (since I wish the editor would use the user timezone):
dateOfAction: moment(dateOfLoss, 'YYYY-MM-DD HH:mm Z').tz(userTimzone).unix()
, So dateOfAction
is 1542776400
. That is: Wednesday, November 21, 2018 5:00:00 AM
- and so far so good. That is the dateOfAction in UTC with after right offset
I'm using react-datetime
as the calendar the edit the date, using UTC.
When performing the save
action, without touching the date, the calendar output is still 1542783600
, but I wish to be 1542783600
- i.e the same value as in the beginning, reverting the offset at the other direction.
How can I achieve that?