carbon 是一个轻量级、语义化、对开发者友好的 Golang 时间处理库,提供了对时间穿越、时间差值、时间极值、时间判断、星座、星座、农历、儒略日 / 简化儒略日、波斯历 / 伊朗历的支持。
carbon 目前已捐赠给 [dromara](https://dromara.org/ "dromara") 开源组织,已被 [awesome-go]( https://github.com/avelino/awesome-go#date-and-time "awesome-go") 收录,并获得 [gitee](https://gitee.com "gitee") 2024 年最有价值项目([GVP](https://gitee.com/gcp "GVP"))和 [gitcode](https://gitcode.com "gitcode") 2024 年度 [G-Star](https://gitcode.com/g-star "G-Star") 项目,如果您觉得不错,请给个 star 吧
[github.com/dromara/carbon]( https://github.com/dromara/carbon "github.com/dromara/carbon")
[gitee.com/dromara/carbon]( https://gitee.com/dromara/carbon "gitee.com/dromara/carbon")
[gitcode.com/dromara/carbon]( https://gitcode.com/dromara/carbon "gitcode.com/dromara/carbon")
#### 更新日志
- 将 `Go` 最低版本要求从 `1.18` 提升到 `1.21`
- `Carbon` 结构体的 `SetLanguage` 方法增加对非法 `Language` 结构体的判断
- `Carbon` 结构体的`Parse` 方法增加对 `Postgres`/`SQLite` 时间格式字符串的解析支持
- `Carbon` 结构体的`Parse`/`ParseByLayout`/`ParseByFormat`方法解析 `空字符串` 时返回值从 `nil` 更改成空 `carbon`
- `Carbon` 结构体新增 `IsEmpty` 方法用于判断是否为空 `carbon`
- `Carbon` 结构体新增 `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` 进行单元测试
有疑问加站长微信联系(非本文作者)
