Skip to content

Commit 7b14a70

Browse files
committed
fix years in new years
1 parent 06dc7bc commit 7b14a70

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

sitio-sveltekit/src/routes/+page.server.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,17 @@ export const load: PageServerLoad = async ({ url, platform, setHeaders }) => {
2222
const vuelos = await sql<Vuelo[]>`
2323
WITH flight_data AS (
2424
SELECT *,
25-
(to_timestamp(json->>'stda' || ' ' || to_char(last_updated, 'YYYY'), 'DD/MM HH24:MI YYYY')::timestamp without time zone AT TIME ZONE 'America/Buenos_Aires') AS stda,
25+
(to_timestamp(
26+
json->>'stda' || ' ' ||
27+
CASE
28+
WHEN json->>'stda' LIKE '31/12%' AND split_part(json->>'x_date', '-', 2) = '01'
29+
THEN (split_part(json->>'x_date', '-', 1)::int - 1)::text
30+
ELSE split_part(json->>'x_date', '-', 1)
31+
END,
32+
'DD/MM HH24:MI YYYY'
33+
)::timestamp without time zone AT TIME ZONE 'America/Buenos_Aires') AS stda,
2634
CASE
27-
WHEN LENGTH(json->>'atda') > 0 THEN (to_timestamp(json->>'atda' || ' ' || to_char(last_updated, 'YYYY'), 'DD/MM HH24:MI YYYY')::timestamp without time zone AT TIME ZONE 'America/Buenos_Aires')
35+
WHEN LENGTH(json->>'atda') > 0 THEN (to_timestamp(json->>'atda' || ' ' || split_part(json->>'x_date', '-', 1), 'DD/MM HH24:MI YYYY')::timestamp without time zone AT TIME ZONE 'America/Buenos_Aires')
2836
END AS atda
2937
FROM aerolineas_latest_flight_status
3038
left join airfleets_matriculas

sitio-sveltekit/src/routes/+page.svelte

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -491,17 +491,6 @@
491491
</p>
492492
</div>
493493
</div>
494-
{#if (dayjs(date).date() === 31 && dayjs(date).month() === 11) || (dayjs(date).date() === 1 && dayjs(date).month() === 0)}
495-
<Alert class="mb-4">
496-
<AlertCircleIcon class="size-4" />
497-
498-
<AlertTitle>Problema con los datos</AlertTitle>
499-
<AlertDescription>
500-
Los datos de vuelos pueden ser inexactos debido al cambio de año. Vamos a arreglarlo
501-
eventualmente.
502-
</AlertDescription>
503-
</Alert>
504-
{/if}
505494
{:else}
506495
<p class="mb-4 text-lg">No hay datos de vuelos para mostrar</p>
507496
{/if}

0 commit comments

Comments
 (0)