Updated FormattingDate function (#108)
--------- Co-authored-by: Antoine Phan <hoangtuan11102@gmail.com>
This commit is contained in:
@@ -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 }) => {
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user