feat: add IsLeapYear

This commit is contained in:
dudaodong committed 2023-04-28 14:42:25 +08:00
1 parent 219e31d929
commit 945c59896b
5 files changed
+263 -161

No files matched your search

+6
View File
@@ -218,3 +218,9 @@ func BeginOfYear(t time.Time) time.Time {
func EndOfYear(t time.Time) time.Time {
return BeginOfYear(t).AddDate(1, 0, 0).Add(-time.Nanosecond)
}
// IsLeapYear check if param year is leap year or not.
// Play: todo
func IsLeapYear(year int) bool {
return year%4 == 0 && (year%100 != 0 || year%400 == 0)
}