libero-mcp 0.2.4 → 0.2.5

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.
@@ -3,6 +3,12 @@ export function nowUTC() {
3
3
  }
4
4
  export function nowLocal(offsetMinutes) {
5
5
  const d = new Date();
6
+ // Bug 4 修复(2026-07-31):旧实现多算了一次 getTimezoneOffset():
7
+ // 旧代码 utc = d.getTime() + d.getTimezoneOffset()*60000 // ← 把 UTC 毫秒减回本地墙钟当 UTC
8
+ // 旧代码 local = utc + offset*60000 // ← 又加 offset
9
+ // 在生产 TZ=+08 服务器不传参时 offset=480,被双偏移抵消,返回 UTC 墙钟+08:00 后缀
10
+ // (错位 8 小时)。实测:7/30 22:02:51 北京时间触发的复盘 cron 收到 "14:02:51+08:00"。
11
+ // 正确逻辑:UTC 毫秒 + offset = 该时区墙钟时间(视为 UTC 格式化)+ 拼后缀。
6
12
  const offset = offsetMinutes ?? -d.getTimezoneOffset();
7
13
  if (offset < -720 || offset > 720) {
8
14
  throw new Error(`Timezone offset ${offset} out of range (must be ±720 minutes)`);
@@ -11,9 +17,8 @@ export function nowLocal(offsetMinutes) {
11
17
  const abs = Math.abs(offset);
12
18
  const h = String(Math.floor(abs / 60)).padStart(2, "0");
13
19
  const m = String(abs % 60).padStart(2, "0");
14
- const utc = new Date(d.getTime() + d.getTimezoneOffset() * 60000);
15
- const local = new Date(utc.getTime() + offset * 60000);
16
- const iso = local.toISOString().replace("Z", "");
20
+ const shifted = new Date(d.getTime() + offset * 60000);
21
+ const iso = shifted.toISOString().replace("Z", "");
17
22
  return `${iso}${sign}${h}:${m}`;
18
23
  }
19
24
  export function formatTime(isoString, format) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libero-mcp",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "AI 时间管理教练 MCP 工具集——时间块记录、统计、矩阵诊断、计时、分类、profile",
5
5
  "license": "MIT",
6
6
  "author": "amosyuan",