37 Star 446 Fork 69

GVPdromara/carbon

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gregorian.go 563 Bytes
一键复制 编辑 原始数据 按行查看 历史
// Package calendar is part of the carbon package.
package calendar
import (
"time"
)
// Gregorian defines a Gregorian struct.
type Gregorian struct {
Time time.Time
Error error
}
// String implements "Stringer" interface.
func (g *Gregorian) String() string {
if g == nil {
return ""
}
if g.Time.IsZero() {
return ""
}
return g.Time.String()
}
func (g *Gregorian) IsLeapYear() bool {
if g == nil || g.Error != nil {
return false
}
year := g.Time.Year()
if year%400 == 0 || (year%4 == 0 && year%100 != 0) {
return true
}
return false
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/dromara/carbon.git
git@gitee.com:dromara/carbon.git
dromara
carbon
carbon
v2.6.16

搜索帮助