From 400fb710078963a3ad48c5769f54119ab35c68c7 Mon Sep 17 00:00:00 2001
From: memdmp <memdmp@estrogen.zone>
Date: Mon, 21 Jul 2025 21:50:47 +0000
Subject: fix: meow

---
 src/lib/Timetable.svelte | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

(limited to 'src/lib/Timetable.svelte')

diff --git a/src/lib/Timetable.svelte b/src/lib/Timetable.svelte
index 4a17ca7..307b68b 100644
--- a/src/lib/Timetable.svelte
+++ b/src/lib/Timetable.svelte
@@ -1,5 +1,5 @@
 <script lang="ts">
-  import { browser, dev } from '$app/environment';
+  import { browser, building, dev } from '$app/environment';
   import { page } from '$app/state';
   import { S } from '$lib';
   import { operators } from './aliases';
@@ -10,12 +10,14 @@
 
   let relativeSecondPrecision = $derived(
     ['seconds', 'second', 'sec', 'secs', 's', '2'].includes(
-      page.url.searchParams.get('relative')!
+      building ? null! : page.url.searchParams.get('relative')!
     )
   );
   let isRelativeTime = $derived(
     relativeSecondPrecision ||
-      ['1', 'true'].includes(page.url.searchParams.get('relative')!)
+      ['1', 'true'].includes(
+        building ? null! : page.url.searchParams.get('relative')!
+      )
   );
   /** only if isRelativeTime is true */
   let now = $state(0);
@@ -96,7 +98,7 @@
               ? 'relative-offset-time'
               : 'offset-time'
           ) ?? '0')
-        : ((await import('$env/dynamic/private')).env[
+        : ((typeof process !== 'undefined' ? process.env : undefined)?.env[
             isRelativeTime && !forceAbsolute
               ? 'PRIVATE_RELATIVE_TIME_OFFSET'
               : 'PRIVATE_SERVER_TIMEZONE'
@@ -105,10 +107,12 @@
     if (isRelativeTime && !forceAbsolute) {
       return timeRelative(time.getTime() - offset * 60 * 60 * 1000, relativeTo);
     } else {
-      const hours = time.getHours() + Math.floor(offset);
+      let hours = time.getHours() + Math.floor(offset);
       const minutes = time.getMinutes() + Math.floor((offset % 1) * 60);
       const seconds =
         time.getSeconds() + Math.floor(((offset % 1) * 60) % 1) * 60;
+      if (hours < 0) while (hours < 0) hours += 24;
+      else if (hours >= 24) while (hours >= 24) hours -= 24;
       return (
         hours.toString().padStart(2, '0') +
         ':' +
@@ -261,8 +265,12 @@
           {#if pictogram}
             <Pictogram which={pictogram} />
           {/if}
-          {#if ([Mode.NightRail || Mode.HighspeedRail || Mode.LongDistanceRail || Mode.RegionalFastRail || Mode.RegionalRail].includes(departure.mode) || (departure.mode === 'BUS' && routeShortName.startsWith('EV')) || (departure.mode === 'METRO' && departure.routeShortName.startsWith('S'))) && !avoidGlyph}
-            <LineGlyph currentColor="#fff" kind={routeShortName} />
+          {#if ([Mode.NightRail, Mode.HighspeedRail, Mode.LongDistanceRail, Mode.RegionalFastRail, Mode.RegionalRail].includes(departure.mode) || (departure.mode === 'BUS' && routeShortName.startsWith('EV')) || (departure.mode === 'METRO' && departure.routeShortName.startsWith('S'))) && !avoidGlyph}
+            <LineGlyph
+              currentColor="#fff"
+              kind={routeShortName}
+              nightIsFilled={false}
+            />
           {:else}
             <span
               class="ml-1 -mr-0.5 md:mt-0.5 font-sbb-typo text-nowrap font-bold"
-- 
cgit v1.2.3

