@eshal-bot/chat-widget 0.1.119 → 0.1.121

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.
@@ -89365,12 +89365,22 @@
89365
89365
  const _ISO_DATETIME_CELL_RE = /^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2})?(\.\d+)?(Z|[+-]\d{2}:?\d{2})?)?$/;
89366
89366
  function _formatDateCell(value) {
89367
89367
  if (typeof value !== 'string') return null;
89368
- if (!_ISO_DATETIME_CELL_RE.test(value.trim())) return null;
89369
- const d = new Date(value);
89368
+ const trimmed = value.trim();
89369
+ if (!_ISO_DATETIME_CELL_RE.test(trimmed)) return null;
89370
+ // A date-time string with no trailing 'Z'/offset is parsed by `new
89371
+ // Date()` as LOCAL time (ECMA-262), but we read it back below via UTC
89372
+ // getters - so a timezone-less value must be normalized to UTC first,
89373
+ // or a non-UTC runtime renders the wrong calendar day/time (EV-2783
89374
+ // follow-up). Date-only strings (no time part) are already parsed as
89375
+ // UTC midnight per spec and need no change.
89376
+ const hasTime = /[T ]\d{2}:\d{2}/.test(trimmed);
89377
+ const hasTz = /(Z|[+-]\d{2}:?\d{2})$/.test(trimmed);
89378
+ const parseable = hasTime && !hasTz ? "".concat(trimmed.replace(' ', 'T'), "Z") : trimmed;
89379
+ const d = new Date(parseable);
89370
89380
  if (isNaN(d.getTime())) return null;
89371
- const hasTime = /[T ]\d{2}:\d{2}/.test(value) && (d.getUTCHours() !== 0 || d.getUTCMinutes() !== 0 || d.getUTCSeconds() !== 0);
89381
+ const hasNonMidnightTime = hasTime && (d.getUTCHours() !== 0 || d.getUTCMinutes() !== 0 || d.getUTCSeconds() !== 0);
89372
89382
  const dateStr = "".concat(_MONTH_NAMES[d.getUTCMonth()], " ").concat(d.getUTCDate(), ", ").concat(d.getUTCFullYear());
89373
- if (!hasTime) return dateStr;
89383
+ if (!hasNonMidnightTime) return dateStr;
89374
89384
  const h = d.getUTCHours();
89375
89385
  const ampm = h >= 12 ? 'PM' : 'AM';
89376
89386
  const h12 = h % 12 || 12;