gdias пре 1 недеља
родитељ
комит
2b58c72db1
1 измењених фајлова са 17 додато и 3 уклоњено
  1. 17 3
      src/routes/cpr/+page.svelte

+ 17 - 3
src/routes/cpr/+page.svelte

@@ -996,7 +996,21 @@
   }
 
   function isWithinB3OfflineWindow(date = new Date()) {
-    const hour = date.getHours();
+    let hour = date.getHours();
+    try {
+      const parts = new Intl.DateTimeFormat('pt-BR', {
+        timeZone: 'America/Sao_Paulo',
+        hour: '2-digit',
+        hourCycle: 'h23'
+      }).formatToParts(date);
+      const hourPart = parts.find((part) => part.type === 'hour')?.value;
+      const parsed = Number(hourPart);
+      if (Number.isFinite(parsed)) {
+        hour = parsed;
+      }
+    } catch (err) {
+      hour = date.getHours();
+    }
     return hour >= B3_OFFLINE_START_HOUR || hour < B3_OFFLINE_END_HOUR;
   }
 
@@ -1018,9 +1032,9 @@
     <div class="w-full max-w-xl rounded-2xl bg-white shadow-2xl border border-red-200 dark:bg-gray-900 dark:border-red-800/40 overflow-hidden">
       <div class="px-6 py-5 space-y-4 text-center">
         <p class="text-sm uppercase tracking-[0.3em] text-red-500 font-semibold">Manutenção programada</p>
-        <h2 class="text-2xl font-bold text-gray-900 dark:text-gray-100">B3 indisponível entre 20h e 8h</h2>
+        <h2 class="text-2xl font-bold text-gray-900 dark:text-gray-100">B3 indisponível entre 20h e 8h (horário de Brasília)</h2>
         <p class="text-base text-gray-600 dark:text-gray-300">
-          A emissão de novas CPRs fica temporariamente suspensa enquanto a B3 está offline. Retorne ao dashboard e tente novamente após as 08:00.
+          A emissão de novas CPRs fica temporariamente suspensa enquanto a B3 está offline. Retorne ao dashboard e tente novamente após as 08:00 (horário de Brasília).
         </p>
         <button
           type="button"