Add dayString calculation for CIF updates

This commit is contained in:
Fred Boniface 2024-03-27 23:08:40 +00:00
parent 592675a24b
commit 848f4bf7bd
2 changed files with 23 additions and 0 deletions

22
src/cif/helpers.go Normal file
View 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]
}

View File

@ -6,6 +6,7 @@ import (
"os/signal"
"syscall"
"time"
_ "time/tzdata"
"git.fjla.uk/owlboard/timetable-mgr/background"
"git.fjla.uk/owlboard/timetable-mgr/dbAccess"