Ad
Code
Diff
  • package kumite
    
    import "time"
    
    func CheckWorkHours(dateTime time.Time) bool {
      return 1 <= dateTime.Weekday() && dateTime.Weekday() <= 5 && 8 <= dateTime.Hour() && dateTime.Hour() < 18
    }
    • package kumite
    • import "time"
    • func CheckWorkHours(dateTime time.Time) bool {
    • const (
    • firstWorkingDay = 1
    • lastWorkingDay = 5
    • firstWorkingHour = 8
    • lastWorkingHour = 18
    • )
    • day, hour := dateTime.Weekday(), dateTime.Hour()
    • return firstWorkingDay <= day && day <= lastWorkingDay && firstWorkingHour <= hour && hour < lastWorkingHour
    • return 1 <= dateTime.Weekday() && dateTime.Weekday() <= 5 && 8 <= dateTime.Hour() && dateTime.Hour() < 18
    • }