refactor to ES modules
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user