Skip to content

v2.6.0

Choose a tag to compare

@kuafuRace kuafuRace released this 25 Mar 01:40
· 781 commits to master since this release

⚠️ This is a break update version, please upgrade with caution, but it is strongly recommended to upgrade 这是一个破坏性更新版本,请慎重升级,但是强烈建议升级

English
  • golang minimum version dependency upgraded to 1.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 is nil
  • Add Copy method to deep copy carbon
  • 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 the carbon.go file to this file
  • Change default global timezone from Local to UTC
  • Rename Offset method to ZoneOffset method
  • Rename IsSetTestNow method to IsTestNow method
  • Rename UnSetTestNow method to CleanTestNow method
  • Remove Location method, replaced by Timezone method
  • Change the judgment logic of IsValid and IsInvalid methods, zero time is no longer considered invalid time
  • Update time.Local when setting the global default timezone
  • Refactor database.go and remove 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 field types, use generic fields instead to implement custom output format when MarshalJSON/UnmarshalJSON
中文
  • golang 最低版本依赖升级到 1.18
  • carbon, julian, lunar, persian 从值传递改成指针传递
  • 新增 ZoneName 方法获取时区名称
  • 新增 HasError 方法判断是否有错误
  • 新增 IsNil 方法判断是否是 nil
  • 新增 Copy 方法对 carbon 进行深度复制
  • 新增 WeekStartsAt 方法获取周起始日期
  • 新增示例文件 xxx_example.go
  • 新增constant.go 文件,将常量从 carbon.go 文件迁移到此文件
  • 默认全局时区从 Local 更改为 UTC
  • Offset 方法更名为 ZoneOffset
  • IsSetTestNow 方法更名为 IsTestNow
  • UnSetTestNow 方法更名为 CleanTestNow
  • 移除 Location 方法,由 Timezone 方法替代
  • 更改 IsValidIsInvalid 方法判断逻辑,zero time 不再视为无效时间
  • 设置全局默认时区时同步更新 time.Local
  • 重构 database.go,移除 carbon.DateTimecarbon. DateTimeMilli carbon.DateTimeMicrocarbon.DateTimeNanocarbon. Datecarbon.DateMillicarbon.DateMicrocarbon.DateNanocarbon.Timecarbon.TimeMillicarbon.TimeMicrocarbon.TimeNanocarbon.Timestampcarbon.TimestampMilli carbon.TimestampMicrocarbon.TimestampNano 字段类型, 使用泛型字段替代以实现 MarshalJSON/UnmarshalJSON 时自定义输出格式