blob: 4a48d2907e33a8cb8e6acc2e73bf5fe09461c07c [file] [log] [blame]
PineaFane69bd222022-12-04 22:18:20 +00001function getSeason() {
2 let year = new Date().getFullYear();
3
4 const dates = {
5 pride: [new Date(`${year}-6-1`), new Date(`${year}-6-31`)],
6 halloween: [new Date(`${year}-10-25`), new Date(`${year}-11-1`)],
7 trans: [new Date(`${year}-11-13`), new Date(`${year}-11-19`)],
PineappleFan37476d22023-02-03 21:36:40 +00008 christmas: [new Date(`${year}-12-1`), new Date(`${year}-12-26`)],
9 aprilFools: [new Date(`${year}-04-01`), new Date(`${year}-04-01`)]
PineaFane69bd222022-12-04 22:18:20 +000010 }
11 const filePaths = {
12 normal: "normal",
13 halloween: "seasonal/halloween",
14 christmas: "seasonal/christmas",
15 pride: "seasonal/pride",
PineappleFan37476d22023-02-03 21:36:40 +000016 trans: "seasonal/trans",
17 aprilFools: "seasonal/aprilFools"
PineaFane69bd222022-12-04 22:18:20 +000018 }
19
20 let current = new Date();
21 let currentSeason = Object.keys(dates).find((str) => current >= dates[str][0] && current <= dates[str][1]) || "normal";
22
23 return {
24 season: currentSeason,
25 filePath: filePaths[currentSeason]
26 }
27}
28
29const Season = async (req, res) => {
30 return res.status(200).send(getSeason());
31}
32
33export default Season;
34export { getSeason };