I am sending a selected date set to the start of the day ( hours, minutes and seconds set to 0) converted to UTC date and the offset from new Date().getTimezoneOffset()
from my client side application to my server. In the server I need to convert the UTC date back to the original date to show in a report. But when I try to convert the UTC date back to the date in the original timezone, it is off by a date. I have found that this is the case for dates for dates before November 4th and believe it might be because of daylight savings time.
I am using moment on the server with moment(utcDate).utcOffset(offset).format('DD/MM/YYYY')
to try and get the correct date.
If the date being sent is the UTC formatted date of 26/10/2019 00:00 from PST then at the server when it is converted back, I am getting 25/10/2019.
The UTC date being sent from the client is 2019-11-01T07:00:00.000Z and offset being sent is 480. At the server I tried to get the date back by using moment('2019-11-01T07:00:00.000Z').utcOffset(-480).format('DD/MM/YYYY hh:mm a') and got "31/10/2019 11:00 pm"