Add dayString calculation for CIF updates
This commit is contained in:
parent
592675a24b
commit
848f4bf7bd
22
src/cif/helpers.go
Normal file
22
src/cif/helpers.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package cif
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.fjla.uk/owlboard/timetable-mgr/log"
|
||||||
|
"go.uber.org/zap"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getDayString() string {
|
||||||
|
london, err := time.LoadLocation("Europe/London")
|
||||||
|
if err != nil {
|
||||||
|
log.Msg.Error("Unable to load time zone info", zap.Error(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
timeNow := time.Now().In(london)
|
||||||
|
day := timeNow.Weekday()
|
||||||
|
|
||||||
|
dayStrings := [...]string{"sun", "mon", "tue", "wed", "thu", "fri", "sat"}
|
||||||
|
|
||||||
|
return dayStrings[day]
|
||||||
|
}
|
@ -6,6 +6,7 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
_ "time/tzdata"
|
||||||
|
|
||||||
"git.fjla.uk/owlboard/timetable-mgr/background"
|
"git.fjla.uk/owlboard/timetable-mgr/background"
|
||||||
"git.fjla.uk/owlboard/timetable-mgr/dbAccess"
|
"git.fjla.uk/owlboard/timetable-mgr/dbAccess"
|
||||||
|
Loading…
Reference in New Issue
Block a user