From 36d8f05aa98611a8b776d2f9a99b70c4a246da34 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 25 Apr 2024 14:46:55 -0400 Subject: [PATCH 1/2] Disable view event button for past events --- src/routes/community/+page.svelte | 6 +++--- src/routes/community/EventCard.svelte | 14 +++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/routes/community/+page.svelte b/src/routes/community/+page.svelte index 1611c5d3ed..e6a2a3f8b9 100644 --- a/src/routes/community/+page.svelte +++ b/src/routes/community/+page.svelte @@ -6,7 +6,7 @@ src: '/images/community/events/28march-office-hours.png', alt: '' }, - date: 'March 28th, 2024', + date: '2024-03-28', location: 'Discord', title: 'Office Hours: Ask me anything!', description: 'Join us for another round of Office Hours, where we answer your questions and geek out on everything tech and Appwrite!', @@ -18,7 +18,7 @@ src: '/images/community/events/4april-office-hours.png', alt: '' }, - date: 'April 4th, 2024', + date: '2024-04-04', location: 'Discord', title: 'Office Hours: Ask me anything!', description: 'Join us for another round of Office Hours, where we answer your questions and geek out on everything tech and Appwrite!', @@ -30,7 +30,7 @@ src: '/images/community/events/11april-office-hours.png', alt: '' }, - date: 'April 11th, 2024', + date: '2024-04-11', location: 'Discord', title: 'Office Hours: Ask me anything!', description: 'Join us for another round of Office Hours, where we answer your questions and geek out on everything tech and Appwrite!', diff --git a/src/routes/community/EventCard.svelte b/src/routes/community/EventCard.svelte index 2f123a005d..2201586c77 100644 --- a/src/routes/community/EventCard.svelte +++ b/src/routes/community/EventCard.svelte @@ -26,6 +26,13 @@ export let buttonText: $$Props['buttonText']; export let headingLevel: $$Props['headingLevel'] = 5; $: headingTag = `h${headingLevel}`; + let hasPast: boolean = (new Date()) > (new Date(date)); + console.log(hasPast); + let dateString: string = new Date(date).toLocaleDateString('en-US', { + month: 'long', + day: 'numeric', + year: 'numeric', + }); @@ -36,7 +43,7 @@