diff --git a/components/Venue/venue.js b/components/Venue/venue.js index dae60cba..85a138e0 100644 --- a/components/Venue/venue.js +++ b/components/Venue/venue.js @@ -3,28 +3,39 @@ import React from 'react'; import Link from 'next/link'; import Image from 'next/image'; +export function isEventEnded(date){ + const eventDate = date.split(" "); + const month = eventDate[0]; + const year = eventDate[eventDate.length-1]; + const startDay = eventDate[1].split("-")[0]; + return new Date(`${startDay} ${month} ${year}`) < Date.now() +} + + function Venue({ className, city }) { + + const eventEnded = isEventEnded(city.date); + const textColor = eventEnded ? "text-white": "text-white"; + return ( -