From c526d560a3e8ed9b2dc9a23825b8979c00a152ba Mon Sep 17 00:00:00 2001 From: Factiven Date: Mon, 1 May 2023 01:09:33 +0700 Subject: Update v3.5 > Bug Fixes > Editor List Update v0.8 > Display adjustment on search page --- components/footer.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'components/footer.js') diff --git a/components/footer.js b/components/footer.js index 90ae982..3494810 100644 --- a/components/footer.js +++ b/components/footer.js @@ -3,9 +3,12 @@ import Instagram from "./media/instagram"; import Link from "next/link"; import Image from "next/image"; import { signIn, useSession } from "next-auth/react"; +import { useState } from "react"; function Footer() { const { data: session, status } = useSession(); + const [year, setYear] = useState(new Date().getFullYear()); + const [season, setSeason] = useState(getCurrentSeason()); return (
@@ -39,7 +42,11 @@ function Footer() {
  • - This Season + + This Season +
  • Popular Anime @@ -83,3 +90,29 @@ function Footer() { } export default Footer; + +function getCurrentSeason() { + const now = new Date(); + const month = now.getMonth() + 1; // getMonth() returns 0-based index + + switch (month) { + case 12: + case 1: + case 2: + return "WINTER"; + case 3: + case 4: + case 5: + return "SPRING"; + case 6: + case 7: + case 8: + return "SUMMER"; + case 9: + case 10: + case 11: + return "FALL"; + default: + return "UNKNOWN SEASON"; + } +} -- cgit v1.2.3