Synchronize javascript-angular time with server time

0

Good, I have a php-based website and manages the client part with angular. My problem is that when someone enters with the time changed to the time of Spain or different time zone the function Date of javascript is not worth me since the countdown do not work well, angulardate does not show the date well, for example if I have the date is on 06/18/2017 6:00 PM, if I change my time zone my watch to GTM + 2 is changed to 06/18/2017 7:00 PM.

There would be some way to force JavaScript to use the server time reference.

    
asked by Francisco Manuel Gonzalez Triv 18.06.2017 в 14:17
source

1 answer

0

in modern browsers you can use something like this:

new Date().toLocaleString("en-US")

You could try to make it every time a date is generated with the server's timeZone.

On the other hand, in my opinion the cleanest solution is to always work with dates in UTC, since it is a neutral time zone.

    
answered by 22.06.2017 в 09:44