refactor to ES modules

This commit is contained in:
2023-12-02 13:27:37 +01:00
parent 1137d26cd6
commit 308baf0b16
8 changed files with 206 additions and 139 deletions
+26
View File
@@ -0,0 +1,26 @@
export default class Day {
static date = new Date() // maybe easier to offset time zone later
static update() {
Day.date = new Date()
}
static get today() {
return Day.date.getDay()
}
static get tomorrow() {
let day = Day.today + 1
if (day > 6) day -= 6
return day
}
static get secondsUntilFullMinute() {
return (60 - Day.date.getSeconds()).toString().padStart(2, '0')
}
static get minutesPassedSinceMidnight() {
return Day.date.getHours() * 60 + Day.date.getMinutes()
}
}