update version from 1.5.3 to 2.0.0

This commit is contained in:
gouguoyin 2021-09-06 10:50:38 +08:00
parent d03187493b
commit 30f40eee63

View File

@ -1,7 +1,7 @@
// @Package carbon
// @Description a simple, semantic and developer-friendly golang package for datetime
// @Page github.com/golang-module/carbon
// @Version v1.5.3
// @Version v2.0.0
// @Author gouguoyin
// @Blog www.gouguoyin.cn
// @Email contact@gouguoyin.cn
@ -150,7 +150,7 @@ const (
// Carbon defines a Carbon struct.
// 定义 Carbon 结构体
type Carbon struct {
Time time.Time
time time.Time
weekStartsAt time.Weekday
loc *time.Location
lang *Language
@ -167,14 +167,14 @@ func NewCarbon() Carbon {
// 将 time.Time 转换成 Carbon
func Time2Carbon(tt time.Time) Carbon {
c := NewCarbon()
c.Time = tt
c.time = tt
return c
}
// Carbon2Time converts Carbon to time.Time.
// 将 Carbon 转换成 time.Time
func (c Carbon) Carbon2Time() time.Time {
return c.Time.In(c.loc)
return c.time.In(c.loc)
}
// Now returns a Carbon instance for now.
@ -186,7 +186,7 @@ func (c Carbon) Now(timezone ...string) Carbon {
if c.Error != nil {
return c
}
c.Time = time.Now().In(c.loc)
c.time = time.Now().In(c.loc)
return c
}
@ -206,9 +206,9 @@ func (c Carbon) Tomorrow(timezone ...string) Carbon {
return c
}
if c.IsZero() {
c.Time = time.Now().In(c.loc).AddDate(0, 0, 1)
c.time = time.Now().In(c.loc).AddDate(0, 0, 1)
} else {
c.Time = c.Time.In(c.loc).AddDate(0, 0, 1)
c.time = c.time.In(c.loc).AddDate(0, 0, 1)
}
return c
}
@ -229,9 +229,9 @@ func (c Carbon) Yesterday(timezone ...string) Carbon {
return c
}
if c.IsZero() {
c.Time = time.Now().In(c.loc).AddDate(0, 0, -1)
c.time = time.Now().In(c.loc).AddDate(0, 0, -1)
} else {
c.Time = c.Time.In(c.loc).AddDate(0, 0, -1)
c.time = c.time.In(c.loc).AddDate(0, 0, -1)
}
return c
}