I have a website where users can log in with a specific timezone, regardless of the client-side timezone. When a user selects a date on the website, it is sent to the server side using JSON.stringify along with other properties. However, when the date is received on the server side, it appears to change due to timezone conversion.
For example:
If I log in using the India time zone (+05:30) and select "01/08/2015 00:00:00", but the server is set to Casablanca Timezone, the date received at the server side shows as "31/07/2015". This discrepancy is likely caused by timezone conversion.
I have already looked into some resources such as this Stack Overflow thread and tried implementing the proposed solutions without success. The formula provided in the answer (link here) is complex and difficult for me to understand, so I am seeking a more detailed and specific solution.
Requirement:
Users are only allowed to select a date, and I want the exact same date to be received on the server side without any changes.
How can I achieve this? Please provide more detailed information if possible. Is there a straightforward way to prevent this timezone collision?