Change Log
v2.6.8 (2025-06-12)
- Parsing when layouts or formats is empty, returns a error
- Upgrade
gorm.io/gorm
from1.21.1
to1.30.0
intests
- Upgrade
gorm.io/driver/mysql
from1.5.7
to1.6.0
intests
- Upgrade
gorm.io/driver/postgres
from1.5.7
to1.6.0
intests
- Upgrade
gorm.io/driver/sqlite
from1.5.7
to1.6.0
intests
- Rename
DateTimeType
todateTimeType
,DateTimeXXXType
todateTimeXXXType
intype_builtin.go
- Rename
DateType
todateType
,DateXXXType
todateXXXType
intype_builtin.go
- Rename
TimeType
totimeType
,TimeXXXType
totimeXXXType
intype_builtin.go
- Simplify readme file and migrate overview and example usage to the official doc website
- Add HelloGitHub badge link
v2.6.7 (2025-05-26)
String
method removes the check for null value carbon- Rename
type_interface.go
file tointerfaces.go
- Change the second parameter of the
Closest
/Farthest
methods to an optional parameter - Add
ZeroValue
/EpochValue
methods - Add
DataTyper
interface, and enable builtin types to implement theDataTyper
interface
v2.6.6 (2025-05-19)
- Fix bug locale file cannot be found on
Windows
os - Fix bug lose of values of
layout
,weekStartsAt
,weekendDays
andlang
when create newCarbon
instance - Fix bug
StartOfWeek
andEndOfWeek
methods change originalCarbon
instance Unexpectedly - Add
curd
integration testing forxorm
, currently coveringMySQL
/Postgres
/SQLite
- Add unit testing for the
Windows
os inci
action
v2.6.5 (2025-05-14)
- Upgrade
go
version from1.18
to1.21
SetLanguage
method ofCarbon
struct add check for invalidLanguage
structParse
method ofCarbon
struct add support forPostgres
/SQLite
time format stringParse
/ParseByLayout
/ParseByFormat
methods ofCarbon
struct change the return value fromnil
toempty
carbon when parsing anempty
stringCarbon
struct addIsEmpty
method to determine if it is anempty
carbonCarbon
struct addClearTestNow
method to replaceCleanTestNow
,CleanTestNow
will be removed in the futureCarbon
struct addParseByLayouts
method to replaceParseWithLayouts
,ParseWithLayouts
will be removed in the futureCarbon
struct addParseByFormats
method to replaceParseWithFormats
,ParseWithFormats
will be removed in the futureCarbon
struct removeGormDataType
method and changeValue
/MarshalJSON
methods frompointer
receiver tovalue
receiverLayoutType[T]
struct removeGormDataType
method and changeValue
/MarshalJSON
methods frompointer
receiver tovalue
receiverFormatType[T]
struct removeGormDataType
method and changeValue
/MarshalJSON
methods frompointer
receiver tovalue
receiverTimestampType[T]
struct removeGormDataType
method and changeValue
/MarshalJSON
methods frompointer
receiver tovalue
receiverSetResources
method ofLanguage
struct add check invalid resources- Add
curd
integration testing forgorm
, currently coveringMySQL
/Postgres
/SQLite
- Replace
github.com/stretchr/testify/assert
withgithub.com/stretchr/testify/suite
for unit testing
v2.6.4 (2025-04-28)
- Fix panic when database field type was
nil
- Split
database_types.go
intotype_carbon.go
,type_layout.go
,type_format.go
,type_timestamp.go
- Rename
LayoutFactory
interface toLayoutTyper
andSetLayout
method toLayout
- Rename
FormatFactory
interface toFormatTyper
andSeFormat
method toFormat
- Rename
TimestampFactory
interface toTimestampTyper
andSePrecision
method toPrecision
- Add
b.ResetTimer()
in benchmark test files - Add
Copy
method forLanguage
struct - Add
carbon.Timestamp
type alias andcarbon.NewTimestamp
method - Add
carbon.TimestampMilli
type alias andcarbon.NewTimestampMilli
method - Add
carbon.TimestampMicro
type alias andcarbon.NewTimestampMicro
method - Add
carbon.TimestampNano
type alias andcarbon.NewTimestampNano
method - Add
carbon.DateTime
type alias andcarbon.NewDateTime
method - Add
carbon.DateTimeMicro
type alias andcarbon.NewDateTimeMicro
method - Add
carbon.DateTimeMilli
type alias andcarbon.NewDateTimeMilli
method - Add
carbon.DateTimeNano
type alias andcarbon.NewDateTimeNano
method - Add
carbon.Date
type alias andcarbon.NewDate
method - Add
carbon.DateMilli
type alias andcarbon.NewDateMilli
method - Add
carbon.DateMicro
type alias andcarbon.NewDateMicro
method - Add
carbon.DateNano
type alias andcarbon.NewDateNano
method - Add
carbon.Time
type alias andcarbon.NewTime
method - Add
carbon.TimeMilli
type alias andcarbon.NewTimeMilli
method - Add
carbon.TimeMicro
type alias andcarbon.NewTimeMicro
method - Add
carbon.TimeNano
type alias andcarbon.NewTimeNano
method
v2.6.3 (2025-04-21)
- Fix bug with the same results in different countries using
IsWeekend
andIsWeekday
methods. - Fix bug
carbon.Parse("").StdTime()
cause a nil pointer panic. #294 - Change errors from
private
method topublic
method. - Change the default start date of the week from
Sunday
toMonday
- Change the year of
MinValue
from-9998
to1
- Change
weeksPerLongYear
constant toWeeksPerLongYear
- Add benchmark test files
xxx_bench_test.go
- Add
IsEpoch
method to report whether is a unix epoch time(1970-01-01 00:00:00 +0000 UTC). - Add
WeekEndsAt
method to get end day of the week. - Add
SetWeekendDays
method to set weekend days of the week. - Add
DefaultWeekStartsAt
global variable to store weekend days of the week.
v2.6.2 (2025-04-08)
- Remove
hour
,Minute
,second
parameter inCreateFromLunar
,CreateFromPersian
methods - Change some format symbol definitions involves symbols such as
U
,V
,X
,S
,T
Z
,u
,v
,x
,z
- Fix bug of incorrect judgment of
IsLeapMonth
in lunar calendar - Fix bug of
AtomFormat
andAtomLayout
return inconsistent value - Fix bug of
RFC3339Format
andRFC3339Layout
return inconsistent value time.Local
is not updated when setting global time zone- Add format symbol
o
to get time zone offset - Add
TimestampLayout
,TimestampMilliLayout
,TimestampMicroLayout
andTimestampNanoLayout
constants - Add
TimestampFormat
,TimestampMilliFormat
,TimestampMicroFormat
andTimestampNanoFormat
constants - Add
DateTimeMilli
,DateTimeMicro
,DateTimeNano
field types - Add
DateMilli
、DateMicro
、DateNano
field types - Add
TimeMilli
、TimeMicro
、TimeNano
field types - Fix missing timezone bug in
IsDST
method - Fix missing timezone bug
StartOfXXX
,EndOfXXX
methods - Fix missing timezone bug when converting other calendars to
Gregorian
calendar time.Local
is not updated when setting default timezone- Add
MaxDuration
,MinDuration
methods
v2.6.1 (2025-03-27)
- Add
ParseWithLayouts
andParseWithFormats
methods - Rename
formatFactory
interface toFormatFactory
,formatFactory
interface toFormatFactory
,formatFactory
interface toFormatFactory
, and add type constraints - Change the return value of the
GormDataType
method of theLayoutType
,FormatType
,TimestampType
struct
totime
- Change
DateTime
,Date
,Time
types fromstruct
tostring
- Change
Timestamp
、TimestampMilli
、TimestampMicro
,TimestampNano
types fromstruct
toint64
- Move built-in database field types to new file
types.go
- Fixed
updated_at
field is automatically updated and invalid whengorm
updates data
v2.6.0 (2025-03-25)
golang
minimum version dependency upgraded to1.18
carbon
,julian
,lunar
,persian
changed from value passing to pointer passing- Add
ZoneName
method to get the time zone name - Add
HasError
method to check if there is an error - Add
IsNil
method to check if it isnil
- Add
Copy
method to deep copycarbon
- Add
WeekStartsAt
method to get start day of the week - Add example file
xxx_example.go
- Add a new
constant.go
file and migrate constants from thecarbon.go
file to this file - Change default global timezone from
Local
toUTC
- Rename
Offset
method toZoneOffset
method - Rename
IsSetTestNow
method toIsTestNow
method - Rename
UnSetTestNow
method toCleanTestNow
method - Remove
Location
method, replaced byTimezone
method - Change the judgment logic of
IsValid
andIsInvalid
methods,zero time
is no longer considered invalid time - Update
time.Local
when setting the global default timezone - Refactor
database.go
and 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.TimestampNano
field types, use generic fields instead to implement custom output format whenMarshalJSON/UnmarshalJSON
Refer to releases for change logs of earlier versions