1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-11 00:02:28 +08:00

feat: add IsLeapYear

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

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)
}