
Carbon 2.6.0 Released: A Lightweight Golang Time Handling Library

Carbon is a lightweight, semantic, and developer-friendly Golang time handling library. It supports time travel, time difference calculations, time extremes, time judgments, zodiac signs, constellations, the lunar calendar, Julian Day / Modified Julian Day, and the Persian (Iranian) calendar.
Carbon has been donated to the dromara[1] open-source organization, included in awesome-go[2], and has received the gitee[3] 2024 Most Valuable Project (GVP[4]) award and the gitcode[5] 2024 G-Star[6] award. If you find it useful, please give it a star!
github.com/dromara/carbon[7]
gitee.com/dromara/carbon[8]
gitcode.com/dromara/carbon[9]
Changelog
- Minimum
golang
version requirement upgraded to1.18
carbon
,julian
,lunar
, andpersian
changed from value passing to pointer passing- Added
ZoneName
method to retrieve the timezone name - Added
HasError
method to check for errors - Added
IsNil
method to check if the value isnil
- Added
Copy
method for deep copying acarbon
instance - Added example files
xxx_example.go
- Added
constant.go
file; constants migrated fromcarbon.go
to this file - Default global timezone changed from
Local
toUTC
- Renamed
Offset
method toZoneOffset
- Renamed
IsSetTestNow
method toIsTestNow
- Renamed
UnSetTestNow
method toCleanTestNow
- Removed
Location
method, replaced byTimezone
method - Modified the logic of
IsValid
andIsInvalid
methods;zero time
is no longer considered invalid - Setting the global default timezone now simultaneously updates
time.Local
- Refactored
database.go
; removedcarbon.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
, andcarbon.TimestampNano
field types. Replaced with generic fields to enable custom output formatting duringMarshalJSON/UnmarshalJSON
References
[1]
dromara: https://dromara.org/
[2]
awesome-go: https://github.com/avelino/awesome-go#date-and-time
[3]
gitee: https://gitee.com
[4]
GVP: https://gitee.com/gcp
[5]
gitcode: https://gitcode.com
[6]
G-Star: https://gitcode.com/g-star
[7]
github.com/dromara/carbon: https://github.com/dromara/carbon
[8]
gitee.com/dromara/carbon: https://gitee.com/dromara/carbon
[9]
gitcode.com/dromara/carbon: https://gitcode.com/dromara/carbon