I want to calculate an order rate: 1 and 2 in that often:
00:00 - 12:00 = fare 1;
12:01 - 23:59 = fare 2;
But my local device has GMT + 3 while my server has UTC. So there a 3 hours gap.
If I send to the server my current date, with hour of 02:00, it will convert it to UTC so it will be 23:00 and be counted on fare 2 instead of fare 1.
I want to preserve the 02:00 to the UTC of the server.
Approach 1: send the current date to the server + offset.
Approach 2: send the date without any offset element, and the server will calculate the offset from within the date object itself.
In approach 2. the server always calculates the same offset. So as I understand, the new Date().getTimezoneOffset()
is result coming of the same machine, not something that was translated against the date object, right?
So my question is I have to send the offset in the request as a solid parameter, or that can be some way that the remote server will take the original date object as string from the client and calculate its offset.