1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

fix: wrongly displayed timezone offset

This commit is contained in:
Ferdinand Mütsch
2022-01-02 20:25:07 +01:00
parent f69dce39d8
commit 8b8c5675af
4 changed files with 12 additions and 2 deletions

View File

@ -107,6 +107,12 @@ func FmtWakatimeDuration(d time.Duration) string {
return fmt.Sprintf("%d hrs %d mins", h, m)
}
// LocalTZOffset returns the time difference between server local time and UTC
func LocalTZOffset() time.Duration {
_, offset := time.Now().Zone()
return time.Duration(offset * int(time.Second))
}
// https://stackoverflow.com/a/18632496
func firstDayOfISOWeek(year int, week int, timezone *time.Location) time.Time {
date := time.Date(year, 0, 0, 0, 0, 0, 0, timezone)