-
Festgehalten von
-
-
-
{quote.creator?.name}
+
+
+
+
Festgehalten von
+
+
+
{quote.creator?.name}
+
+
+ am{' '}
+ {formatDate(new Date(quote.timestamp))}
+
+
-
- am{' '}
- {new Date(quote.timestamp).toLocaleDateString('de-AT', {
- year: 'numeric',
- month: 'long',
- day: 'numeric',
- })}
-
-
-
+ {#if anniversaryYears !== null}
+
Heute vor {anniversaryYears} Jahr{anniversaryYears !== 1 ? 'en' : ''} 🎉
+ {/if}
+
diff --git a/app/src/components/ui/card.svelte b/app/src/components/ui/card.svelte
index d532fe0..0bc7c25 100644
--- a/app/src/components/ui/card.svelte
+++ b/app/src/components/ui/card.svelte
@@ -5,7 +5,7 @@
-
diff --git a/app/src/lib/date.ts b/app/src/lib/date.ts
new file mode 100644
index 0000000..5b19b1d
--- /dev/null
+++ b/app/src/lib/date.ts
@@ -0,0 +1,15 @@
+export const getAnniversaryYears = (created: Date) => {
+ const today = new Date()
+ if (created.getDate() === today.getDate() && created.getMonth() === today.getMonth()) {
+ return today.getFullYear() - created.getFullYear()
+ }
+ return null
+}
+
+export const formatDate = (date: Date) => {
+ return date.toLocaleDateString('de-AT', {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric',
+ })
+}
diff --git a/app/src/routes/+page.svelte b/app/src/routes/+page.svelte
index 774240c..4555150 100644
--- a/app/src/routes/+page.svelte
+++ b/app/src/routes/+page.svelte
@@ -1,4 +1,5 @@
diff --git a/app/src/routes/quote/[slug]/+page.svelte b/app/src/routes/quote/[slug]/+page.svelte
index 6ff22e9..415ac38 100644
--- a/app/src/routes/quote/[slug]/+page.svelte
+++ b/app/src/routes/quote/[slug]/+page.svelte
@@ -1,4 +1,5 @@
- doofus-rick - {quote.content.substring(0, 25)}...
+
+
+
+
+
+