Releases: dromara/carbon
v2.6.6
English
- Fix bug locale file cannot be found on
Windowsos - Fix bug lose of values of
layout,weekStartsAt,weekendDaysandlangwhen create newCarboninstance #303 - Fix bug
StartOfWeekandEndOfWeekmethods change originalCarboninstance Unexpectedly #304 - Add
curdintegration testing forxorm, currently coveringMySQL/Postgres/SQLite - Add unit testing for the
Windowsos inciaction
中文
v2.6.5
English
- Upgrade
goversion from1.18to1.21 SetLanguagemethod ofCarbonstruct add check for invalidLanguagestructParsemethod ofCarbonstruct add support forPostgres/SQLitetime format stringParse/ParseByLayout/ParseByFormatmethods ofCarbonstruct change the return value fromniltoemptycarbon when parsing anemptystringCarbonstruct addIsEmptymethod to determine if it is anemptycarbonCarbonstruct addClearTestNowmethod to replaceCleanTestNow,CleanTestNowwill be removed in the futureCarbonstruct addParseByLayoutsmethod to replaceParseWithLayouts,ParseWithLayoutswill be removed in the futureCarbonstruct addParseByFormatsmethod to replaceParseWithFormats,ParseWithFormatswill be removed in the futureCarbonstruct removeGormDataTypemethod and changeValue/MarshalJSONmethods frompointerreceiver tovaluereceiverLayoutType[T]struct removeGormDataTypemethod and changeValue/MarshalJSONmethods frompointerreceiver tovaluereceiverFormatType[T]struct removeGormDataTypemethod and changeValue/MarshalJSONmethods frompointerreceiver tovaluereceiverTimestampType[T]struct removeGormDataTypemethod and changeValue/MarshalJSONmethods frompointerreceiver tovaluereceiverSetResourcesmethod ofLanguagestruct add check invalid resources- Add
curdintegration testing forgorm, currently coveringMySQL/Postgres/SQLite - Replace
github.com/stretchr/testify/assertwithgithub.com/stretchr/testify/suitefor unit testing
中文
- 将
Go最低版本要求从1.18提升到1.21 Carbon结构体的SetLanguage方法增加对非法Language结构体的判断Carbon结构体的Parse方法增加对Postgres/SQLite时间格式字符串的解析支持Carbon结构体的Parse/ParseByLayout/ParseByFormat方法解析空字符串时返回值从nil更改成空carbonCarbon结构体新增IsEmpty方法用于判断是否为空carbonCarbon结构体新增ClearTestNow方法替代CleanTestNow,CleanTestNow方法未来将移除Carbon结构体新增ParseByLayouts方法替代ParseWithLayouts,ParseWithLayouts方法未来将移除Carbon结构体新增ParseByFormats方法替代ParseWithLayouts,ParseWithFormats方法未来将移除Carbon结构体移除GormDataType方法, 并将Value/MarshalJSON方法从指针接收者改成值接收者LayoutType[T]结构体移除GormDataType方法, 并将Value/MarshalJSON方法从指针接收者改成值接收者FormatType[T]结构体移除GormDataType方法, 并将Value/MarshalJSON方法从指针接收者改成值接收者TimestampType[T]结构体移除GormDataType方法, 并将Value/MarshalJSON方法从指针接收者改成值接收者Language结构体的SetResources方法增加对非法资源的判断- 新增对
gorm的curd集成测试,目前已覆盖MySQL/Postgres/SQLite - 使用
github.com/stretchr/testify/assert替换github.com/stretchr/testify/suite进行单元测试
v2.5.10
English
- Upgrade
goversion from1.18to1.21 SetLanguagemethod ofCarbonstruct add check for invalidLanguagestructParsemethod ofCarbonstruct add support forMySQL/Postgres/SQLitetime format stringParse/ParseByLayout/ParseByFormatmethods ofCarbonstruct change the return value fromniltoemptycarbon when parsing anemptystringCarbonstruct addIsEmptymethod to determine if it is anemptycarbonCarbonstruct addClearTestNowmethod to replaceCleanTestNow,CleanTestNowwill be removed in the futureCarbonstruct addParseByLayoutsmethod to replaceParseWithLayouts,ParseWithLayoutswill be removed in the futureCarbonstruct addParseByFormatsmethod to replaceParseWithFormats,ParseWithFormatswill be removed in the futureCarbonstruct removeGormDataTypemethod and changeValue/MarshalJSONmethods frompointerreceiver tovaluereceiverLayoutType[T]struct removeGormDataTypemethod and changeValue/MarshalJSONmethods frompointerreceiver tovaluereceiverFormatType[T]struct removeGormDataTypemethod and changeValue/MarshalJSONmethods frompointerreceiver tovaluereceiverTimestampType[T]struct removeGormDataTypemethod and changeValue/MarshalJSONmethods frompointerreceiver tovaluereceiverSetResourcesmethod ofLanguagestruct add check invalid resources- Add
curdintegration testing forgorm, currently coveringMySQL/Postgres/SQLite - Replace
github.com/stretchr/testify/assertwithgithub.com/stretchr/testify/suitefor unit testing
中文
- 将
Go最低版本要求从1.18提升到1.21 Carbon结构体的SetLanguage方法增加对非法Language结构体的判断Carbon结构体的Parse方法增加对MySQL/Postgres/SQLite时间格式字符串的解析支持Carbon结构体的Parse/ParseByLayout/ParseByFormat方法解析空字符串时返回值从nil更改成空carbonCarbon结构体新增IsEmpty方法用于判断是否为空carbonCarbon结构体新增ClearTestNow方法替代CleanTestNow,CleanTestNow方法未来将移除Carbon结构体新增ParseByLayouts方法替代ParseWithLayouts,ParseWithLayouts方法未来将移除Carbon结构体新增ParseByFormats方法替代ParseWithLayouts,ParseWithFormats方法未来将移除Carbon结构体移除GormDataType方法, 并将Value/MarshalJSON方法从指针接收者改成值接收者LayoutType[T]结构体移除GormDataType方法, 并将Value/MarshalJSON方法从指针接收者改成值接收者FormatType[T]结构体移除GormDataType方法, 并将Value/MarshalJSON方法从指针接收者改成值接收者TimestampType[T]结构体移除GormDataType方法, 并将Value/MarshalJSON方法从指针接收者改成值接收者Language结构体的SetResources方法增加对非法资源的判断- 新增对
gorm的curd集成测试,目前已覆盖MySQL/Postgres/SQLite - 使用
github.com/stretchr/testify/assert替换github.com/stretchr/testify/suite进行单元测试
v2.6.4
English
-
Fix panic when database field type was
nil -
Split
database_types.gointotype_carbon.go,type_layout.go,type_format.go,type_timestamp.go -
Rename
LayoutFactoryinterface toLayoutTyperandSetLayoutmethod toLayout -
Rename
FormatFactoryinterface toFormatTyperandSeFormatmethod toFormat -
Rename
TimestampFactoryinterface toTimestampTyperandSePrecisionmethod toPrecision -
Add
b.ResetTimer()in benchmark test files -
Add
Copymethod forLanguagestruct -
Add
carbon.Timestamptype alias andcarbon.NewTimestampmethod -
Add
carbon.TimestampMillitype alias andcarbon.NewTimestampMillimethod -
Add
carbon.TimestampMicrotype alias andcarbon.NewTimestampMicromethod -
Add
carbon.TimestampNanotype alias andcarbon.NewTimestampNanomethod -
Add
carbon.DateTimetype alias andcarbon.NewDateTimemethod -
Add
carbon.DateTimeMicrotype alias andcarbon.NewDateTimeMicromethod -
Add
carbon.DateTimeMillitype alias andcarbon.NewDateTimeMillimethod -
Add
carbon.DateTimeNanotype alias andcarbon.NewDateTimeNanomethod -
Add
carbon.Datetype alias andcarbon.NewDatemethod -
Add
carbon.DateMillitype alias andcarbon.NewDateMillimethod -
Add
carbon.DateMicrotype alias andcarbon.NewDateMicromethod -
Add
carbon.DateNanotype alias andcarbon.NewDateNanomethod -
Add
carbon.Timetype alias andcarbon.NewTimemethod -
Add
carbon.TimeMillitype alias andcarbon.NewTimeMillimethod -
Add
carbon.TimeMicrotype alias andcarbon.NewTimeMicromethod -
Add
carbon.TimeNanotype alias andcarbon.NewTimeNanomethod
中文
-
修复数据库字段类型为
nil时抛出异常的bug -
将
database_types.go拆分成type_carbon.go,type_layout.go,type_format.go,type_timestamp.go -
将
LayoutFactory接口重命名为LayoutTyper和SetLayout方法重命名为Layout -
将
FormatFactory接口重命名为FormatTyper和SetFormat方法重命名为Format -
将
TimestampFactory接口重命名为TimestampTyper和SetPrecision方法重命名为Precision -
性能测试文件增加
b.ResetTimer() -
Language结构体新增Copy方法 -
新增
carbon.Timestamp类型别名和carbon.NewTimestamp方法 -
新增
carbon.TimestampMilli类型别名和carbon.NewTimestampMilli方法 -
新增
carbon.TimestampMicro类型别名和carbon.NewTimestampMicro方法 -
新增
carbon.TimestampNano类型别名和carbon.NewTimestampNano方法 -
新增
carbon.DateTime类型别名和carbon.NewDateTime方法 -
新增
carbon.DateTimeMicro类型别名和carbon.NewDateTimeMicro方法 -
新增
carbon.DateTimeMilli类型别名和carbon.NewDateTimeMilli方法 -
新增
carbon.DateTimeNano类型别名和carbon.NewDateTimeNano方法 -
新增
carbon.Date类型别名和carbon.NewDate方法 -
新增
carbon.DateMilli类型别名和carbon.NewDateMilli方法 -
新增
carbon.DateMicro类型别名和carbon.NewDateMicro方法 -
新增
carbon.DateNano类型别名和carbon.NewDateNano方法 -
新增
carbon.Time类型别名和carbon.NewTime方法 -
新增
carbon.TimeMilli类型别名和carbon.NewTimeMilli方法 -
新增
carbon.TimeMicro类型别名和carbon.NewTimeMicro方法 -
新增
carbon.TimeNano类型别名和carbon.NewTimeNano方法
v2.5.9
English
-
Fix panic when database field type was
nil -
Split
database_types.gointotype_carbon.go,type_layout.go,type_format.go,type_timestamp.go -
Rename
LayoutFactoryinterface toLayoutTyperandSetLayoutmethod toLayout -
Rename
FormatFactoryinterface toFormatTyperandSeFormatmethod toFormat -
Rename
TimestampFactoryinterface toTimestampTyperandSePrecisionmethod toPrecision -
Add
b.ResetTimer()in benchmark test files -
Add
Copymethod forLanguagestruct -
Add
carbon.Timestamptype alias andcarbon.NewTimestampmethod -
Add
carbon.TimestampMillitype alias andcarbon.NewTimestampMillimethod -
Add
carbon.TimestampMicrotype alias andcarbon.NewTimestampMicromethod -
Add
carbon.TimestampNanotype alias andcarbon.NewTimestampNanomethod -
Add
carbon.DateTimetype alias andcarbon.NewDateTimemethod -
Add
carbon.DateTimeMicrotype alias andcarbon.NewDateTimeMicromethod -
Add
carbon.DateTimeMillitype alias andcarbon.NewDateTimeMillimethod -
Add
carbon.DateTimeNanotype alias andcarbon.NewDateTimeNanomethod -
Add
carbon.Datetype alias andcarbon.NewDatemethod -
Add
carbon.DateMillitype alias andcarbon.NewDateMillimethod -
Add
carbon.DateMicrotype alias andcarbon.NewDateMicromethod -
Add
carbon.DateNanotype alias andcarbon.NewDateNanomethod -
Add
carbon.Timetype alias andcarbon.NewTimemethod -
Add
carbon.TimeMillitype alias andcarbon.NewTimeMillimethod -
Add
carbon.TimeMicrotype alias andcarbon.NewTimeMicromethod -
Add
carbon.TimeNanotype alias andcarbon.NewTimeNanomethod
中文
-
修复数据库字段类型为
nil时抛出异常的bug -
将
database_types.go拆分成type_carbon.go,type_layout.go,type_format.go,type_timestamp.go -
将
LayoutFactory接口重命名为LayoutTyper和SetLayout方法重命名为Layout -
将
FormatFactory接口重命名为FormatTyper和SetFormat方法重命名为Format -
将
TimestampFactory接口重命名为TimestampTyper和SetPrecision方法重命名为Precision -
性能测试文件增加
b.ResetTimer() -
Language结构体新增Copy方法 -
新增
carbon.Timestamp类型别名和carbon.NewTimestamp方法 -
新增
carbon.TimestampMilli类型别名和carbon.NewTimestampMilli方法 -
新增
carbon.TimestampMicro类型别名和carbon.NewTimestampMicro方法 -
新增
carbon.TimestampNano类型别名和carbon.NewTimestampNano方法 -
新增
carbon.DateTime类型别名和carbon.NewDateTime方法 -
新增
carbon.DateTimeMicro类型别名和carbon.NewDateTimeMicro方法 -
新增
carbon.DateTimeMilli类型别名和carbon.NewDateTimeMilli方法 -
新增
carbon.DateTimeNano类型别名和carbon.NewDateTimeNano方法 -
新增
carbon.Date类型别名和carbon.NewDate方法 -
新增
carbon.DateMilli类型别名和carbon.NewDateMilli方法 -
新增
carbon.DateMicro类型别名和carbon.NewDateMicro方法 -
新增
carbon.DateNano类型别名和carbon.NewDateNano方法 -
新增
carbon.Time类型别名和carbon.NewTime方法 -
新增
carbon.TimeMilli类型别名和carbon.NewTimeMilli方法 -
新增
carbon.TimeMicro类型别名和carbon.NewTimeMicro方法 -
新增
carbon.TimeNano类型别名和carbon.NewTimeNano方法
v2.6.3
English
- Fix bug with the same results in different countries using
IsWeekendandIsWeekdaymethods. - Fix bug
carbon.Parse("").StdTime()cause a nil pointer panic. #294 - Change errors from
privatemethod topublicmethod. - Change the default start date of the week from
SundaytoMonday - Change the year of
MinValuefrom-9998to1 - Change
weeksPerLongYearconstant toWeeksPerLongYear - Add benchmark test files
xxx_bench_test.go - Add
IsEpochmethod to report whether is a unix epoch time(1970-01-01 00:00:00 +0000 UTC). - Add
WeekEndsAtmethod to get end day of the week. - Add
SetWeekendDaysmethod to set weekend days of the week. - Add
DefaultWeekStartsAtglobal variable to store weekend days of the week.
中文
- 修复
IsWeekend,IsWeekday方法不同国家返回结果一致的 bug - 修复
StdTime方法空指针引起的异常 #294 - 将错误方法由
私有方法改成公开方法 - 将一周默认开始日期从
周日改成周一 - 将
MinValue方法的年份从-9998更改为1 - 将
weeksPerLongYear常量更名为WeeksPerLongYear - 新增性能测试文件
xxx_bench_test.go - 新增
IsEpoch方法用于判断是否是 UNIX 纪元时间(1970-01-01 00:00:00 +0000 UTC) - 新增
WeekEndsAt方法用于获取一周的结束日期 - 新增
SetWeekendDays方法用于设置一周周末日期 - 新增
DefaultWeekStartsAt全局变量用于存储默认一周休息日
v2.5.8
English
- Fix bug with the same results in different countries using
IsWeekendandIsWeekdaymethods. - Change errors from
privatemethod topublicmethod. - Change the default start date of the week from
SundaytoMonday - Change the year of
MinValuefrom-9998to1 - Change
weeksPerLongYearconstant toWeeksPerLongYear - Add
IsEpochmethod to report whether is a unix epoch time(1970-01-01 00:00:00 +0000 UTC). - Add
WeekEndsAtmethod to get end day of the week. - Add
SetWeekendDaysmethod to set weekend days of the week. - Add
DefaultWeekStartsAtglobal variable to store weekend days of the week.
中文
- 修复
IsWeekend,IsWeekday方法不同国家返回结果一致的 bug - 将错误方法由
私有方法改成公开方法 - 将一周默认开始日期从
周日改成周一 - 将
MinValue方法的年份从-9998更改为1 - 将
weeksPerLongYear常量更名为WeeksPerLongYear - 新增
IsEpoch方法用于判断是否是 UNIX 纪元时间(1970-01-01 00:00:00 +0000 UTC) - 新增
WeekEndsAt方法用于获取一周的结束日期 - 新增
SetWeekendDays方法用于设置一周周末日期 - 新增
DefaultWeekStartsAt全局变量用于存储默认一周休息日
v2.6.2
English
- Remove
hour,Minute,secondparameter inCreateFromLunar,CreateFromPersianmethods - Change some format symbol definitions involves symbols such as
U,V,X,S,TZ,u,v,x,z - Fix bug of incorrect judgment of
IsLeapMonthin lunar calendar - Fix bug of
AtomFormatandAtomLayoutreturn inconsistent value - Fix bug of
RFC3339FormatandRFC3339Layoutreturn inconsistent value time.Localis not updated when setting global time zone- Add format symbol
oto get time zone offset - Add
TimestampLayout,TimestampMilliLayout,TimestampMicroLayoutandTimestampNanoLayoutconstants - Add
TimestampFormat,TimestampMilliFormat,TimestampMicroFormatandTimestampNanoFormatconstants - Add
DateTimeMilli,DateTimeMicro,DateTimeNanofield types - Add
DateMilli、DateMicro、DateNanofield types - Add
TimeMilli、TimeMicro、TimeNanofield types - Fix missing timezone bug in
IsDSTmethod - Fix missing timezone bug
StartOfXXX,EndOfXXXmethods - Fix missing timezone bug when converting other calendars to
Gregoriancalendar time.Localis not updated when setting default timezone- Add
MaxDuration,MinDurationmethods
中文
CreateFromLunar,CreateFromPersian方法去掉 hour, minute, second 参数- 更改部分格式符号定义,涉及到的符号有
U,V,X,S,TZ,u,v,x,z - 修复农历中
IsLeapMonth判断错误的 bug - 修复
AtomFormat和AtomLayout格式返回值不一致的 bug - 修复
RFC3339Format和RFC3339Layout格式返回值不一致的 bug - 设置全局默认时区时不再同步更新
time.Local - 新增格式符号
o来获取时区偏移量 - 新增
TimestampLayout、TimestampMilliLayout、TimestampMicroLayout和TimestampNanoLayout常量 - 新增
TimestampFormat、TimestampMilliFormat、TimestampMicroFormat和TimestampNanoFormat常量 - 新增
DateTimeMilli、DateTimeMicro、DateTimeNano字段类型 - 新增
DateMilli、DateMicro、DateNano字段类型 - 新增
TimeMilli、TimeMicro、TimeNano字段类型 - 修复
IsDST方法丢失时区的 bug - 修复
StartOfXXX、EndOfXXX部分方法丢失时区的 bug - 修复其他日历转化为公历时缺失时区的 bug
- 设置默认时区时不再同步更新
time.Local - 新增
MaxDuration、MinDuration方法
v2.5.6
v2.5.5
English
-
golangminimum version dependency upgraded to1.18 -
Change default global timezone from
LocaltoUTC -
Remove
hour,Minute,secondparameter inCreateFromLunar,CreateFromPersianmethods -
Change some format symbol definitions involves symbols such as
U,V,X,S,TZ,u,v,x,z -
Fix bug of incorrect judgment of
IsLeapMonthin lunar calendar -
Fix bug of
AtomFormatandAtomLayoutreturn inconsistent value -
Fix bug of
RFC3339FormatandRFC3339Layoutreturn inconsistent value -
Fix missing timezone bug in
IsDSTmethod -
Fix missing timezone bug
StartOfXXX,EndOfXXXmethods -
Rename
Offsetmethod toZoneOffsetmethod -
Rename
IsSetTestNowmethod toIsTestNowmethod -
Rename
UnSetTestNowmethod toCleanTestNowmethod -
Remove
Locationmethod, replaced byTimezonemethod -
Change the judgment logic of
IsValidandIsInvalidmethods,zero timeis no longer considered invalid time -
Add
ZoneNamemethod to get the time zone name -
Add
HasErrormethod to check if there is an error -
Add
WeekStartsAtmethod to get start day of the week -
Add
ParseWithLayoutsandParseWithFormatsmethods -
Add format symbol
oto get time zone offset
中文
-
golang最低版本依赖升级到1.18 -
默认全局时区从
Local更改为UTC -
CreateFromLunar,CreateFromPersian方法去掉 hour, minute, second 参数 -
更改部分格式符号定义,涉及到的符号有
U,V,X,S,TZ,u,v,x,z -
修复
IsDST方法丢失时区的 bug -
修复
StartOfXXX、EndOfXXX部分方法丢失时区的 bug -
修复农历中
IsLeapMonth判断错误的 bug -
修复
AtomFormat和AtomLayout格式返回值不一致的 bug -
修复
RFC3339Format和RFC3339Layout格式返回值不一致的 bug -
Offset方法更名为ZoneOffset -
IsSetTestNow方法更名为IsTestNow -
UnSetTestNow方法更名为CleanTestNow -
移除
Location方法,由Timezone方法替代 -
更改
IsValid和IsInvalid方法判断逻辑,zero time不再视为无效时间 -
新增
ZoneName方法获取时区名称 -
新增
HasError方法判断是否有错误 -
新增
WeekStartsAt方法获取周起始日期 -
新增
ParseWithLayouts和ParseWithFormats方法 -
新增格式符号
o来获取时区偏移量