1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-10 07:42:27 +08:00

feat: add IsWeekend

This commit is contained in:
dudaodong
2023-05-31 17:23:47 +08:00
parent 6dc017a5fa
commit f274375e62
4 changed files with 103 additions and 0 deletions

View File

@@ -205,3 +205,8 @@ func DayOfYear(t time.Time) int {
return int(nowDate.Sub(firstDay).Hours() / 24)
}
// IsWeekend checks if passed time is weekend or not.
func IsWeekend(t time.Time) bool {
return time.Saturday == t.Weekday() || time.Sunday == t.Weekday()
}