Closed aldy120 closed 3 months ago
採用格式化後的台北時間作為輸出。
const options = {
timeZone: 'Asia/Taipei',
timeStyle: 'long',
dateStyle: 'full'
};
// The datetime returned from the API response is wrong
const wrongTime = article.datetime;
const correctTime = wrongTime.substring(0, wrongTime.length - 1) + '+0800';
const timeTaipei = new Date(correctTime).toLocaleString('zh-TW', options);
顯示的時間錯誤。點進去內文看時間是 +0800 的才對。
2024-03-20T20:58:57.000Z
應改為2024-03-20T20:58:57.000+0800