Assuming two date-time value “2023-04-07T04:58:00.000Z” and “2023-04-07T17:58:00.000Z”.
This can have a day difference of 0 days in UTC timezone, however in some other timezone, lets say, CDT, there will be a difference of one day.
I want to calculate the number of days, depending on user’s location, using Javascript Date, between two given dates.
Some cases to be considered:
- date 1 can be end date of a month, and date 2 can be start date of another month
- date 1 can be end date of year, and date 2 can be start date of another year.
I am looking for a function that will return me the number of days between two date, with time, in UTC, when executed on user’s browser.