on 2018-09-20

JavaScript - 使用與處理正確的時間

這是個很有趣的議題

舉凡使用倒數計時器或限時開賣等

只要在網頁上牽扯到時間的動態呈現都需要處理這問題

會列舉了幾個情況與介紹一些跟時間相關的的概念與 API

Refer - 深入理解定时器系列第一篇——理解setTimeout和setInterval

var options = {
    timeZone: 'Europe/London',
    year: 'numeric', month: 'numeric', day: 'numeric',
    hour: 'numeric', minute: 'numeric', second: 'numeric',
};
formatter = new Intl.DateTimeFormat([], options);
formatter.format(new Date());

Refer - Get time of specific timezone [duplicate]

Refer - Getting To Know The JavaScript Internationalization API

Refer - Javascript 的 EventLoop