1 Star 0 Fork 64

liuzw3018/carbon

forked from dromara/carbon 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
test.go 1.05 KB
一键复制 编辑 原始数据 按行查看 历史
package carbon
// SetTestNow sets a test Carbon instance (real or mock) to be returned when a "now" instance is created.
func SetTestNow(carbon Carbon) Carbon {
return NewCarbon().SetTestNow(carbon)
}
// SetTestNow sets a test Carbon instance (real or mock) to be returned when a "now" instance is created.
func (c Carbon) SetTestNow(carbon Carbon) Carbon {
c.time = carbon.time
c.loc = carbon.loc
c.weekStartsAt = carbon.weekStartsAt
c.lang = carbon.lang
c.isTestNow = true
return c
}
// ClearTestNow clears a test Carbon instance (real or mock) to be returned when a "now" instance is created.
func ClearTestNow() Carbon {
return NewCarbon().ClearTestNow()
}
// ClearTestNow clears a test Carbon instance (real or mock) to be returned when a "now" instance is created.
func (c Carbon) ClearTestNow() Carbon {
c.isTestNow = false
return c
}
// HasTestNow reports whether is the test now time.
func HasTestNow() bool {
return NewCarbon().HasTestNow()
}
// HasTestNow reports whether is the test now time.
func (c Carbon) HasTestNow() bool {
return c.isTestNow
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/liuzw3018/carbon.git
git@gitee.com:liuzw3018/carbon.git
liuzw3018
carbon
carbon
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385