Updated FormattingDate function (#108)

---------

Co-authored-by: Antoine Phan <hoangtuan11102@gmail.com>
This commit is contained in:
Karen Chen
2026-02-24 15:25:58 -05:00
committed by GitHub
parent 2062efa87d
commit 3f77dfffc2
2 changed files with 13 additions and 2 deletions

View File

@@ -25,7 +25,18 @@ const homepageQuery = `{
}`; }`;
function formattingDate(date: Date) { function formattingDate(date: Date) {
return date.toISOString().slice(0, 10).replaceAll('-', '/'); const month = date.getMonth() + 1;
const year = date.getFullYear();
if (month >= 1 && month <= 4) {
return `Winter ${year}`;
}
if (month >= 8 && month <= 12) {
return `Fall ${year}`;
}
return 'Closed for the summer';
} }
export const load = async ({ url }) => { export const load = async ({ url }) => {

View File

@@ -75,7 +75,7 @@
{#if data.ohLastUpdated} {#if data.ohLastUpdated}
<br /> <br />
<span class="text-ecsess-200/70 mb-4 inline-block italic"> <span class="text-ecsess-200/70 mb-4 inline-block italic">
Last updated: {data.ohLastUpdated} Semester: {data.ohLastUpdated}
</span> </span>
{/if} {/if}
</p> </p>