fix(review-resolve): 支援 wrapper findings 並修正輸出格式
This commit is contained in:
+16
-11
@@ -1,3 +1,14 @@
|
||||
const timestampFormatter = new Intl.DateTimeFormat('zh-TW', {
|
||||
timeZone: 'Asia/Taipei',
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit',
|
||||
hourCycle: 'h23',
|
||||
});
|
||||
|
||||
/**
|
||||
* 依 `spec-time-log` 規範產生台灣時區(Asia/Taipei)的固定格式時間戳 `yyyy/MM/dd HH:mm:ss`。
|
||||
* 供本模組所有輸出函式在訊息前加上 `[時間]` 前綴使用。
|
||||
@@ -6,17 +17,11 @@
|
||||
* @returns {string} 例如 `2026/08/07 12:39:43`。
|
||||
*/
|
||||
function formatTimestamp(date = new Date()) {
|
||||
const parts = new Intl.DateTimeFormat('zh-TW', {
|
||||
timeZone: 'Asia/Taipei',
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit',
|
||||
hourCycle: 'h23',
|
||||
}).formatToParts(date);
|
||||
const map = Object.fromEntries(parts.map((p) => [p.type, p.value]));
|
||||
const parts = timestampFormatter.formatToParts(date);
|
||||
const map = parts.reduce((acc, part) => {
|
||||
acc[part.type] = part.value;
|
||||
return acc;
|
||||
}, {});
|
||||
return `${map.year}/${map.month}/${map.day} ${map.hour}:${map.minute}:${map.second}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user