rottg commited on
Commit
171ae15
·
1 Parent(s): e7fbe02

Update code

Browse files
Files changed (1) hide show
  1. templates/chat.html +4 -0
templates/chat.html CHANGED
@@ -536,12 +536,16 @@
536
 
537
  function formatDate(dateStr) {
538
  if (!dateStr) return '';
 
 
539
  const d = new Date(dateStr);
540
  return d.toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'Asia/Jerusalem' });
541
  }
542
 
543
  function formatTime(dateStr) {
544
  if (!dateStr) return '';
 
 
545
  const d = new Date(dateStr);
546
  return d.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit', hour12: false, timeZone: 'Asia/Jerusalem' });
547
  }
 
536
 
537
  function formatDate(dateStr) {
538
  if (!dateStr) return '';
539
+ // Add 'Z' to treat as UTC (Telegram stores dates in UTC without timezone indicator)
540
+ if (!dateStr.endsWith('Z') && !dateStr.includes('+')) dateStr += 'Z';
541
  const d = new Date(dateStr);
542
  return d.toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'Asia/Jerusalem' });
543
  }
544
 
545
  function formatTime(dateStr) {
546
  if (!dateStr) return '';
547
+ // Add 'Z' to treat as UTC (Telegram stores dates in UTC without timezone indicator)
548
+ if (!dateStr.endsWith('Z') && !dateStr.includes('+')) dateStr += 'Z';
549
  const d = new Date(dateStr);
550
  return d.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit', hour12: false, timeZone: 'Asia/Jerusalem' });
551
  }