
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
golangversion requirement upgraded to1.18 carbon,julian,lunar, andpersianchanged from value passing to pointer passing- Added
ZoneNamemethod to retrieve the timezone name - Added
HasErrormethod to check for errors - Added
IsNilmethod to check if the value isnil - Added
Copymethod for deep copying acarboninstance - Added example files
xxx_example.go - Added
constant.gofile; constants migrated fromcarbon.goto this file - Default global timezone changed from
LocaltoUTC - Renamed
Offsetmethod toZoneOffset - Renamed
IsSetTestNowmethod toIsTestNow - Renamed
UnSetTestNowmethod toCleanTestNow - Removed
Locationmethod, replaced byTimezonemethod - Modified the logic of
IsValidandIsInvalidmethods;zero timeis 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.TimestampNanofield 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