isWorktime reports true after close of work hours [bug]
Closed this issue · 0 comments
Tarang commented
Say i had a calendar
package main
import (
"fmt"
"time"
"github.com/rickar/cal/v2"
)
func main() {
//Set work hours
c := cal.NewBusinessCalendar()
//Set hours as 10:00:00 am to 5:00:00 pm
c.SetWorkHours(10*time.Hour+00*time.Minute, 5*time.Hour+0*time.Minute+00*time.Second)
// Check if its work hours
t := time.Date(0, 0, 0, 5, 0, 59, 0, time.UTC)
isWorkHours := c.IsWorkTime(t) //Should return false
fmt.Println(isWorkHours)
}
The output should be false
as at 5:00:59 pm it is passed 5:00:00 pm by 59 seconds. The isWorkHours should take granularity down to seconds so that at 5:00:01 pm it is outside of work hours, vs 5:01:00 pm (a whole minute later).
Fixed in #109