Releases: dromara/carbon
Releases · dromara/carbon
v2.6.2-rc1
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
中文
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字段类型
v2.6.1
English
- Add
ParseWithLayoutsandParseWithFormatsmethods - Rename
formatFactoryinterface toFormatFactory,formatFactoryinterface toFormatFactory,formatFactoryinterface toFormatFactory, and add type constraints - Change the return value of the
GormDataTypemethod of theLayoutType,FormatType,TimestampTypestructtotime - Change
DateTime,Date,Timetypes fromstructtostring - Change
Timestamp、TimestampMilli、TimestampMicro,TimestampNanotypes fromstructtoint64 - Move built-in database field types to new file
types.go - Fixed
updated_atfield is automatically updated and invalid whengormupdates data
中文
- 新增
ParseWithLayouts和ParseWithFormats方法 - 将
formatFactory接口更名为FormatFactory,formatFactory接口更名为FormatFactory,formatFactory接口更名为FormatFactory, 并添加类型约束 - 将
LayoutType,FormatType,TimestampType结构体GormDataType方法的返回值更改为time - 将
DateTime、Date、Time类型从struct更改为string - 将
Timestamp、TimestampMilli、TimestampMicro,TimestampNano类型从struct更改为int64 - 将内置数据库字段类型移动到新文件
types.go - 修复
gorm更新数据时updated_at字段自动更新无效的 bug
v2.6.0
English
golangminimum version dependency upgraded to1.18carbon,julian,lunar,persianchanged from value passing to pointer passing- Add
ZoneNamemethod to get the time zone name - Add
HasErrormethod to check if there is an error - Add
IsNilmethod to check if it isnil - Add
Copymethod to deep copycarbon - Add
WeekStartsAtmethod to get start day of the week - Add example file
xxx_example.go - Add a new
constant.gofile and migrate constants from thecarbon.gofile to this file - Change default global timezone from
LocaltoUTC - 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 - Update
time.Localwhen setting the global default timezone - Refactor
database.goand removecarbon.DateTime,carbon. DateTimeMilli,carbon.DateTimeMicro,carbon.DateTimeNano,carbon. Date,carbon.DateMilli,carbon.DateMicro,carbon.DateNano,carbon.Time,carbon.TimeMilli,carbon.TimeMicro,carbon.TimeNano,carbon.Timestamp,carbon.TimestampMilli,carbon.TimestampMicro,carbon.TimestampNanofield types, use generic fields instead to implement custom output format whenMarshalJSON/UnmarshalJSON
中文
golang最低版本依赖升级到1.18carbon,julian,lunar,persian从值传递改成指针传递- 新增
ZoneName方法获取时区名称 - 新增
HasError方法判断是否有错误 - 新增
IsNil方法判断是否是nil - 新增
Copy方法对carbon进行深度复制 - 新增
WeekStartsAt方法获取周起始日期 - 新增示例文件
xxx_example.go - 新增
constant.go文件,将常量从carbon.go文件迁移到此文件 - 默认全局时区从
Local更改为UTC Offset方法更名为ZoneOffsetIsSetTestNow方法更名为IsTestNowUnSetTestNow方法更名为CleanTestNow- 移除
Location方法,由Timezone方法替代 - 更改
IsValid和IsInvalid方法判断逻辑,zero time不再视为无效时间 - 设置全局默认时区时同步更新
time.Local - 重构
database.go,移除carbon.DateTime、carbon. DateTimeMilli、carbon.DateTimeMicro、carbon.DateTimeNano、carbon. Date、carbon.DateMilli、carbon.DateMicro、carbon.DateNano、carbon.Time、carbon.TimeMilli、carbon.TimeMicro、carbon.TimeNano、carbon.Timestamp、carbon.TimestampMilli、carbon.TimestampMicro、carbon.TimestampNano字段类型, 使用泛型字段替代以实现MarshalJSON/UnmarshalJSON时自定义输出格式
v2.5.4
v2.5.3
v2.5.2
What's Changed
- Fix
Time,TimeMilli,TimeMicro,TimeNanotype fields cannot be parsed whenunmarshalJSON - Remove deprecated method
ToStdTime - Add
MaxValue,MinValue,IsValidmethods forGregoriancalendar - Add
MaxValue,MinValue,IsValidmethods forLunarcalendar - Add
MaxValue,MinValue,ToShortMonthString,ToShortWeekStringmethods forPersiancalendar - Add optional parameter
local, optional valueen/faforPersiancalendarToMonthString,ToWeekStringmethods, default isen
Full Changelog: v2.5.1...v2.5.2
v2.5.1
What's Changed
- Add
MaxValue,MinValuemethods - Add reference url
- Optimize
IsValidmethod baseMinValue,MinValue Time,TimeMilli,TimeMicro,TimeNanostructs set year, month, day whenUnmarshalJSON- Fix minor grammar and notation corrections by @You-saku in #260
- Bump
github.com/stretchr/testifyfrom1.9.0to1.10.0by @dependabot in #261
Full Changelog: v2.5.0...v2.5.1
v2.5.0
What's Changed
- Change repository url from
github.com/golang-module/carbontogithub.com/dromara/carbon - Add
hungariantranslation #39 by @kenlas in #252 - Add support for
stringand[]bytetypes when parsing database data inScanmethod #251 - Retranslate
README.jpby @You-saku in #259 - Fix
DiffInMonths()method bug #255 - Fix
Japanesetranslation by @nkmr-jp in #254 - Replace
Lock()withRLock(),Unlock()withRUnlock()to optimize performance by @ritbrz in #253 - Replace
ToDateTimeStruct()withNewDateTime(),ToDateTimeMilliStruct()withNewDateTimeMilli(),ToDateTimeMicroStruct()withNewDateTimeMicro(),ToDateTimeMilliNanoStruct()withNewDateTimeNano() - Replace
ToDateStruct()withNewDate(),ToDateMilliStruct()withNewDateMilli(),ToDateMicroStruct()withNewDateMicro(),ToDateNanoStruct()withNewDateNano() - Replace
ToTimeStruct()withNewTime(),ToTimeMilliStruct()withNewTimeMilli(),ToTimeMicroStruct()withNewTimeMicro(),ToTimeNano()StructwithNewTimeNano() DateTime,DateTimeXXX,Date,DateXXX,Time,TimeXXXstructures implementScan,Value,MarshalJSON,UnmarshalJSONinterfaces- Bump
codecov/codecov-actionfrom 4 to 5 by @dependabot in #256 - Unified use of global default timezone
defaultTimezonewhenUnmarshalJSON
New Contributors
- @kenlas made their first contribution in #252
- @nkmr-jp made their first contribution in #254
- @You-saku made their first contribution in #259
Full Changelog: v2.4.1...v2.5.0
v2.4.1
v2.4.0
- Fixed
Farsilanguage translation bug #247 - Fixed
gregoriancalendar tolunarcalendar bug #246 - Updated the minimum version of Go required to
1.17#245 - Optimized
ParseByLayoutandgetLocationByTimezonemethods when the timezone is empty - Optimized the scenario of JSON unmarsha when the value of the JSON string is empty or null
- Removed
Tagstruct and related methods - Added
Arabiclanguage support #250