From 30f40eee63d79bcf30a873d1527f710793dd1d20 Mon Sep 17 00:00:00 2001 From: gouguoyin <245629560@qq.com> Date: Mon, 6 Sep 2021 10:50:38 +0800 Subject: [PATCH] update version from 1.5.3 to 2.0.0 --- carbon.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/carbon.go b/carbon.go index f2f7819..052ade8 100755 --- a/carbon.go +++ b/carbon.go @@ -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 }