Set global time zone

前端 未结 5 554
北荒
北荒 2020-12-24 00:23

I am using Moment.js to handle dates in my web application. The server returns all the dates in milliseconds UTC. Now, I have to display the dates applying a specific timezo

5条回答
  •  春和景丽
    2020-12-24 01:18

    I've not done extensive testing, but it looks right on cursory tests. I was able to do this with Moment Timezone 0.0.1:

    var serverTimezoneOffset = ;
    moment.updateOffset(new Date().getTimezoneOffset()-serverTimezoneOffset);
    

提交回复
热议问题