few things:

- easy comparison of hourMinute with .int()
- created Sunset/Sunrise vars of type hourMinute for easy end-user use
This commit is contained in:
Sam Lewis
2022-10-10 00:11:41 -04:00
parent 2597711973
commit 25a843fc7b
4 changed files with 48 additions and 25 deletions
+10 -2
View File
@@ -12,6 +12,10 @@ type hourMinute struct {
Minute int
}
func (hm hourMinute) int() int {
return hm.Hour + hm.Minute
}
func HourMinute(Hour, Minute int) hourMinute {
return hourMinute{Hour, Minute}
}
@@ -76,7 +80,12 @@ type scheduleBuilderEnd struct {
}
func ScheduleBuilder() scheduleBuilder {
return scheduleBuilder{schedule{}}
return scheduleBuilder{
schedule{
frequency: 0,
offset: hourMinute{0, 0},
},
}
}
func (s schedule) String() string {
@@ -88,7 +97,6 @@ func (s schedule) String() string {
}
func frequencyToString(d time.Duration) string {
fmt.Println(d.Hours(), d.Minutes(), d.Seconds())
if d.Hours() == 24 {
return "daily at"
}