speccrew 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -73,10 +73,29 @@ const path = require('path');
|
|
|
73
73
|
// ============================================================================
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* 生成本地时区的 ISO 8601 格式时间戳
|
|
77
|
+
* 例如:2026-04-10T20:38:21.978+08:00
|
|
78
|
+
*/
|
|
79
|
+
function getLocalISOString() {
|
|
80
|
+
const now = new Date();
|
|
81
|
+
const off = -now.getTimezoneOffset();
|
|
82
|
+
const sign = off >= 0 ? '+' : '-';
|
|
83
|
+
const pad2 = n => String(Math.abs(n)).padStart(2, '0');
|
|
84
|
+
const tz = sign + pad2(Math.floor(off / 60)) + ':' + pad2(off % 60);
|
|
85
|
+
return now.getFullYear() + '-' +
|
|
86
|
+
pad2(now.getMonth() + 1) + '-' +
|
|
87
|
+
pad2(now.getDate()) + 'T' +
|
|
88
|
+
pad2(now.getHours()) + ':' +
|
|
89
|
+
pad2(now.getMinutes()) + ':' +
|
|
90
|
+
pad2(now.getSeconds()) + '.' +
|
|
91
|
+
String(now.getMilliseconds()).padStart(3, '0') + tz;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* 生成 ISO 8601 格式时间戳(本地时区)
|
|
77
96
|
*/
|
|
78
97
|
function getTimestamp() {
|
|
79
|
-
return
|
|
98
|
+
return getLocalISOString();
|
|
80
99
|
}
|
|
81
100
|
|
|
82
101
|
/**
|