add day of week
This commit is contained in:
parent
a8f7de6042
commit
4ea575ecf2
8
typed.go
8
typed.go
@ -77,3 +77,11 @@ func WithStaticDate(t time.Time) TimerOptions {
|
|||||||
option.date = t
|
option.date = t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NextDayOfWeek(date time.Time, weekDay int) time.Time {
|
||||||
|
sub := weekDay - int(date.Weekday())
|
||||||
|
if sub <= 0 {
|
||||||
|
sub += 7
|
||||||
|
}
|
||||||
|
return date.Add(time.Hour * 24 * time.Duration(sub))
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user