-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelper.ts
More file actions
30 lines (26 loc) · 742 Bytes
/
helper.ts
File metadata and controls
30 lines (26 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import TimeOfDay from "./Models/TimeOfDay";
import Season from "./Models/Season";
export function getPartOfDay(hour: number): string {
if (5 <= hour && hour < 12) {
return TimeOfDay.values.morning;
}
if (12 <= hour && hour < 17) {
return TimeOfDay.values.afternoon;
}
if (17 <= hour && hour < 21) {
return TimeOfDay.values.evening;
}
return TimeOfDay.values.night;
}
export function getSeason(month: number): string {
if (3 <= month && month < 6) {
return Season.values.spring;
}
if (6 <= month && month < 9) {
return Season.values.summer;
}
if (9 <= month && month < 12) {
return Season.values.fall;
}
return Season.values.winter;
}