-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3cb098
commit f96306d
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export enum DayOfWeek { | ||
Sunday = 0, | ||
Monday = 1, | ||
Tuesday = 2, | ||
Wednesday = 3, | ||
Thursday = 4, | ||
Friday = 5, | ||
Saturday = 6 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import type { DayOfWeek } from "$lib/types/Date" | ||
|
||
// noinspection JSUnusedGlobalSymbols | ||
export const date = new class _ extends Date { | ||
|
||
private readonly date = new Date() | ||
|
||
public getFullMonth(): number { | ||
let month = this.date.getMonth() + 1 | ||
if (month > 10) return Number("0" + month) | ||
return month | ||
} | ||
|
||
public getDayOfWeek(yyyyMMdd: number | string): DayOfWeek { | ||
const dayOfWeek = new Date(yyyyMMdd).getDay() | ||
return dayOfWeek as DayOfWeek | ||
} | ||
|
||
public getDayOfWeekCurrentKr(): string { // lol | ||
const dayOfWeek = new Date().getDay() | ||
switch (dayOfWeek) { | ||
case 0: | ||
return "일" | ||
case 1: | ||
return "월" | ||
case 2: | ||
return "화" | ||
case 3: | ||
return "수" | ||
case 4: | ||
return "목" | ||
case 5: | ||
return "금" | ||
case 6: | ||
return "토" | ||
} | ||
return "??" | ||
} | ||
|
||
} |