forxe usage of norwegian timezone on program page as well
This commit is contained in:
@@ -5,8 +5,11 @@ import ProgramCard from './ProgramCard.astro';
|
|||||||
const { lang = 'no', data } = Astro.props as { lang?: Lang, data: any };
|
const { lang = 'no', data } = Astro.props as { lang?: Lang, data: any };
|
||||||
const t = translations[lang];
|
const t = translations[lang];
|
||||||
|
|
||||||
const today = new Date();
|
const now = new Date();
|
||||||
today.setHours(0, 0, 0, 0);
|
const osloNow = new Date(
|
||||||
|
now.toLocaleString("en-US", { timeZone: "Europe/Oslo" })
|
||||||
|
);
|
||||||
|
osloNow.setHours(0, 0, 0, 0);
|
||||||
---
|
---
|
||||||
|
|
||||||
{data ? (
|
{data ? (
|
||||||
@@ -14,19 +17,33 @@ today.setHours(0, 0, 0, 0);
|
|||||||
<h1 class="font-bold text-3xl text-center w-full">{t.nav.program}</h1>
|
<h1 class="font-bold text-3xl text-center w-full">{t.nav.program}</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-12 flex-wrap justify-center items-stretch">
|
<div class="flex gap-12 flex-wrap justify-center items-stretch">
|
||||||
{Object.entries(data).map(([date, items], idx) => (
|
{Object.entries(data).map(([date, items], idx) => {
|
||||||
<ProgramCard
|
const dateInOslo = new Date(
|
||||||
date={date}
|
new Date(date).toLocaleString("en-US", { timeZone: "Europe/Oslo" })
|
||||||
items={items}
|
);
|
||||||
lang={lang}
|
dateInOslo.setHours(0, 0, 0, 0);
|
||||||
even={idx % 2 === 1}
|
|
||||||
isPast={new Date(date) < today}
|
return (
|
||||||
/>
|
<ProgramCard
|
||||||
))}
|
date={date}
|
||||||
|
items={items}
|
||||||
|
lang={lang}
|
||||||
|
even={idx % 2 === 1}
|
||||||
|
isPast={dateInOslo < osloNow}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
<p class="font-bold text-xl text-center w-full">
|
<p class="font-bold text-xl text-center w-full">
|
||||||
<a href="https://neuf.no/arrangementer" class="text-gyllen-oransje hover:text-slottsblaa hover:underline" target="_blank" rel="noopener noreferrer">{t.program.programMore}</a>
|
<a
|
||||||
|
href="https://neuf.no/arrangementer"
|
||||||
|
class="text-gyllen-oransje hover:text-slottsblaa hover:underline"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
{t.program.programMore}
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
Reference in New Issue
Block a user