문제

My problem:

The web application that I am building is very dependant on that the client and server side clocks are in pretty good sync.

To calculate the offset between the client and server time clock is not a problem, it has very elaborate answers here.

My question is:

Is it possible to alter the default clock from JavaScript which Date etc is based on? Or is my best shot to build an extension of the Date class or similar?

도움이 되었습니까?

해결책

moment.js has a very powerful date api on top of javascript's Date object.

You could look for a plugin (or quite easily build your own) that takes into account some kind of custom 'timezone'. Thus shifting your date-related calculations to any value needed.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top