@mcpcn/mcp-notification 1.1.6 → 1.1.7

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.
Files changed (2) hide show
  1. package/dist/index.js +16 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -311,12 +311,23 @@ class ReminderServer {
311
311
  const mm = String(abs % 60).padStart(2, '0');
312
312
  return `${sign}${hh}:${mm}`;
313
313
  };
314
- const toLocal = (iso) => {
315
- if (!iso)
316
- return iso;
317
- const d = new Date(iso);
314
+ const toLocal = (v) => {
315
+ if (v === undefined || v === null)
316
+ return v;
317
+ let ms;
318
+ if (typeof v === 'number') {
319
+ ms = v > 1e12 ? v : v * 1000;
320
+ }
321
+ else if (typeof v === 'string') {
322
+ const s = v.trim();
323
+ if (/^\d{10}$/.test(s))
324
+ ms = parseInt(s, 10) * 1000;
325
+ else if (/^\d{13}$/.test(s))
326
+ ms = parseInt(s, 10);
327
+ }
328
+ const d = ms !== undefined ? new Date(ms) : new Date(v);
318
329
  if (isNaN(d.getTime()))
319
- return iso;
330
+ return v;
320
331
  const y = d.getFullYear();
321
332
  const m = String(d.getMonth() + 1).padStart(2, '0');
322
333
  const day = String(d.getDate()).padStart(2, '0');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpcn/mcp-notification",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "系统通知MCP服务器",
5
5
  "packageManager": "yarn@1.22.22",
6
6
  "main": "dist/index.js",