Skip to content

Commit

Permalink
fix: hard coded date
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsch318 committed Aug 1, 2024
1 parent 44bf7d4 commit 8a583fb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/panikzettel/page-anim/panikzettel-page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import format from "date-fns/format";
import { format } from "date-fns";
import localFont from "next/font/local";
import Link from "next/link";
import type { ReactNode } from "react";
Expand Down
4 changes: 3 additions & 1 deletion src/app/panikzettel/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default async function Page() {
return (
<div className={"w-screen "}>
<Alert className="mx-auto mt-12 w-4/6">
<Info className="size-4"></Info>
<Info className="size-4" />
<AlertTitle>Achtung! Fertig! Fork!</AlertTitle>
<AlertDescription>
Dies ist weiterhin ein Fork des nun ungepflegten Repositories von{" "}
Expand Down Expand Up @@ -101,6 +101,8 @@ export default async function Page() {
</SkewedPanikzettelFrontpage>
</div>
<svg
role="img"
aria-label="Document with Questionmark"
className="h-[150px] w-screen -translate-y-3 fill-white"
preserveAspectRatio="none"
viewBox="0 0 1920 350"
Expand Down
11 changes: 8 additions & 3 deletions src/app/panikzettel/selection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import Link from "next/link";

import type { Panikzettel } from "@/models/panikzettel";

function UpToDatenessIndicator(date: Date) {
function UpToDatenessIndicator(date?: Date) {
if (!date) {
return "🔴";
}
const now = new Date();
const years = differenceInYears(now, date);

Expand Down Expand Up @@ -34,13 +37,15 @@ export default function PanikzettelSelection({
<hr className="border-black/30" />
<ul className="my-6 ml-6 list-disc px-4 pb-4 [&>li]:mt-2">
{selection.map((x) => {
const date = new Date(2019, 1);
const date = x.date ? new Date(x.date) : undefined;
return (
<li key={x.name}>
<Link href={x.url}>{x.name}</Link>
<span className="ml-2 text-sm text-stone-600">
{UpToDatenessIndicator(date)}{" "}
{format(date, "MMMM yyyy", { locale: de })}
{date
? format(date, "MMMM yyyy", { locale: de })
: "nicht bekannt"}
</span>
</li>
);
Expand Down

0 comments on commit 8a583fb

Please sign in to comment.