I have an angular application, where there are actions that an user can perform. I don't want the user to be able to perform the operations for a back dated or future dated date.
I am using JavaScript date object for getting the current date and passing it to server API. At the API, I check for the correctness of the date and accordingly inform the user in case the date does not match my server date.
document.getElementById("demo").innerHTML = Date();
However, there are 2 issues that I am facing, 1. After changing the system date on windows OS, it takes a lot of time (sometimes more than 10 seconds) for the date object to sync with the system date. 2. The timezone of the client system might not be same as the server time zone.
Can you please tell what is the best mechanism to achieve this behavior.