Ad
Code
Diff
  • package kumite
    
    import "time"
    
    func CheckWorkHours(dateTime time.Time) bool {
      day := dateTime.Weekday()
      if day < time.Monday || day > time.Friday {
        return false
      }
      
      hour := dateTime.Hour()
      return 8 <= hour && hour < 18
    }
    • package kumite
    • import "time"
    • func CheckWorkHours(dateTime time.Time) bool {
    • return 1 <= dateTime.Weekday() && dateTime.Weekday() <= 5 && 8 <= dateTime.Hour() && dateTime.Hour() < 18
    • day := dateTime.Weekday()
    • if day < time.Monday || day > time.Friday {
    • return false
    • }
    • hour := dateTime.Hour()
    • return 8 <= hour && hour < 18
    • }