Skip to content

Releases: dromara/carbon

v2.5.10

14 May 09:23
Compare
Choose a tag to compare
English
  • Upgrade go version from 1.18 to 1.21
  • SetLanguage method of Carbon struct add check for invalid Language struct
  • Parse method of Carbon struct add support for MySQL/Postgres/SQLite time format string
  • Parse/ParseByLayout/ParseByFormat methods of Carbon struct change the return value from nil to empty carbon when parsing an empty string
  • Carbon struct add IsEmpty method to determine if it is an empty carbon
  • Carbon struct add ClearTestNow method to replace CleanTestNow, CleanTestNow will be removed in the future
  • Carbon struct add ParseByLayouts method to replace ParseWithLayouts, ParseWithLayouts will be removed in the future
  • Carbon struct add ParseByFormats method to replace ParseWithFormats, ParseWithFormats will be removed in the future
  • Carbon struct remove GormDataType method and change Value/MarshalJSON methods from pointer receiver to value receiver
  • LayoutType[T] struct remove GormDataType method and change Value/MarshalJSON methods from pointer receiver to value receiver
  • FormatType[T] struct remove GormDataType method and change Value/MarshalJSON methods from pointer receiver to value receiver
  • TimestampType[T] struct remove GormDataType method and change Value/MarshalJSON methods from pointer receiver to value receiver
  • SetResources method of Language struct add check invalid resources
  • Add curd integration testing for gorm, currently covering MySQL/Postgres/SQLite
  • Replace github.com/stretchr/testify/assert with github.com/stretchr/testify/suite for unit testing
中文
  • Go 最低版本要求从 1.18 提升到 1.21
  • Carbon 结构体的 SetLanguage 方法增加对非法 Language 结构体的判断
  • Carbon 结构体的Parse 方法增加对 MySQL/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 方法增加对非法资源的判断
  • 新增对 gormcurd 集成测试,目前已覆盖 MySQL/Postgres/SQLite
  • 使用 github.com/stretchr/testify/assert 替换 github.com/stretchr/testify/suite 进行单元测试

v2.6.4

28 Apr 02:32
Compare
Choose a tag to compare
English
  • Fix panic when database field type was nil

  • Split database_types.go into type_carbon.go, type_layout.go, type_format.go, type_timestamp.go

  • Rename LayoutFactory interface to LayoutTyper and SetLayout method to Layout

  • Rename FormatFactory interface to FormatTyper and SeFormat method to Format

  • Rename TimestampFactory interface to TimestampTyper and SePrecision method to Precision

  • Add b.ResetTimer() in benchmark test files

  • Add Copy method for Language struct

  • Add carbon.Timestamp type alias and carbon.NewTimestamp method

  • Add carbon.TimestampMilli type alias and carbon.NewTimestampMilli method

  • Add carbon.TimestampMicro type alias and carbon.NewTimestampMicro method

  • Add carbon.TimestampNano type alias and carbon.NewTimestampNano method

  • Add carbon.DateTime type alias and carbon.NewDateTime method

  • Add carbon.DateTimeMicro type alias and carbon.NewDateTimeMicro method

  • Add carbon.DateTimeMilli type alias and carbon.NewDateTimeMilli method

  • Add carbon.DateTimeNano type alias and carbon.NewDateTimeNano method

  • Add carbon.Date type alias and carbon.NewDate method

  • Add carbon.DateMilli type alias and carbon.NewDateMilli method

  • Add carbon.DateMicro type alias and carbon.NewDateMicro method

  • Add carbon.DateNano type alias and carbon.NewDateNano method

  • Add carbon.Time type alias and carbon.NewTime method

  • Add carbon.TimeMilli type alias and carbon.NewTimeMilli method

  • Add carbon.TimeMicro type alias and carbon.NewTimeMicro method

  • Add carbon.TimeNano type alias and carbon.NewTimeNano method

中文
  • 修复数据库字段类型为 nil 时抛出异常的bug

  • database_types.go 拆分成 type_carbon.go, type_layout.go, type_format.go, type_timestamp.go

  • LayoutFactory 接口重命名为 LayoutTyperSetLayout 方法重命名为 Layout

  • FormatFactory 接口重命名为 FormatTyperSetFormat 方法重命名为 Format

  • TimestampFactory 接口重命名为 TimestampTyperSetPrecision 方法重命名为 Precision

  • 性能测试文件增加 b.ResetTimer()

  • Language 结构体新增 Copy 方法

  • 新增 carbon.Timestamp 类型别名和 carbon.NewTimestamp 方法

  • 新增 carbon.TimestampMilli 类型别名和 carbon.NewTimestampMilli 方法

  • 新增 carbon.TimestampMicro 类型别名和 carbon.NewTimestampMicro 方法

  • 新增 carbon.TimestampNano 类型别名和 carbon.NewTimestampNano 方法

  • 新增 carbon.DateTime 类型别名和 carbon.NewDateTime 方法

  • 新增 carbon.DateTimeMicro 类型别名和 carbon.NewDateTimeMicro 方法

  • 新增 carbon.DateTimeMilli 类型别名和 carbon.NewDateTimeMilli 方法

  • 新增 carbon.DateTimeNano 类型别名和 carbon.NewDateTimeNano 方法

  • 新增 carbon.Date 类型别名和 carbon.NewDate 方法

  • 新增 carbon.DateMilli 类型别名和 carbon.NewDateMilli 方法

  • 新增 carbon.DateMicro 类型别名和 carbon.NewDateMicro 方法

  • 新增 carbon.DateNano 类型别名和 carbon.NewDateNano 方法

  • 新增 carbon.Time 类型别名和 carbon.NewTime 方法

  • 新增 carbon.TimeMilli 类型别名和 carbon.NewTimeMilli 方法

  • 新增 carbon.TimeMicro 类型别名和 carbon.NewTimeMicro 方法

  • 新增 carbon.TimeNano 类型别名和 carbon.NewTimeNano 方法

v2.5.9

28 Apr 02:31
Compare
Choose a tag to compare
English
  • Fix panic when database field type was nil

  • Split database_types.go into type_carbon.go, type_layout.go, type_format.go, type_timestamp.go

  • Rename LayoutFactory interface to LayoutTyper and SetLayout method to Layout

  • Rename FormatFactory interface to FormatTyper and SeFormat method to Format

  • Rename TimestampFactory interface to TimestampTyper and SePrecision method to Precision

  • Add b.ResetTimer() in benchmark test files

  • Add Copy method for Language struct

  • Add carbon.Timestamp type alias and carbon.NewTimestamp method

  • Add carbon.TimestampMilli type alias and carbon.NewTimestampMilli method

  • Add carbon.TimestampMicro type alias and carbon.NewTimestampMicro method

  • Add carbon.TimestampNano type alias and carbon.NewTimestampNano method

  • Add carbon.DateTime type alias and carbon.NewDateTime method

  • Add carbon.DateTimeMicro type alias and carbon.NewDateTimeMicro method

  • Add carbon.DateTimeMilli type alias and carbon.NewDateTimeMilli method

  • Add carbon.DateTimeNano type alias and carbon.NewDateTimeNano method

  • Add carbon.Date type alias and carbon.NewDate method

  • Add carbon.DateMilli type alias and carbon.NewDateMilli method

  • Add carbon.DateMicro type alias and carbon.NewDateMicro method

  • Add carbon.DateNano type alias and carbon.NewDateNano method

  • Add carbon.Time type alias and carbon.NewTime method

  • Add carbon.TimeMilli type alias and carbon.NewTimeMilli method

  • Add carbon.TimeMicro type alias and carbon.NewTimeMicro method

  • Add carbon.TimeNano type alias and carbon.NewTimeNano method

中文
  • 修复数据库字段类型为 nil 时抛出异常的bug

  • database_types.go 拆分成 type_carbon.go, type_layout.go, type_format.go, type_timestamp.go

  • LayoutFactory 接口重命名为 LayoutTyperSetLayout 方法重命名为 Layout

  • FormatFactory 接口重命名为 FormatTyperSetFormat 方法重命名为 Format

  • TimestampFactory 接口重命名为 TimestampTyperSetPrecision 方法重命名为 Precision

  • 性能测试文件增加 b.ResetTimer()

  • Language 结构体新增 Copy 方法

  • 新增 carbon.Timestamp 类型别名和 carbon.NewTimestamp 方法

  • 新增 carbon.TimestampMilli 类型别名和 carbon.NewTimestampMilli 方法

  • 新增 carbon.TimestampMicro 类型别名和 carbon.NewTimestampMicro 方法

  • 新增 carbon.TimestampNano 类型别名和 carbon.NewTimestampNano 方法

  • 新增 carbon.DateTime 类型别名和 carbon.NewDateTime 方法

  • 新增 carbon.DateTimeMicro 类型别名和 carbon.NewDateTimeMicro 方法

  • 新增 carbon.DateTimeMilli 类型别名和 carbon.NewDateTimeMilli 方法

  • 新增 carbon.DateTimeNano 类型别名和 carbon.NewDateTimeNano 方法

  • 新增 carbon.Date 类型别名和 carbon.NewDate 方法

  • 新增 carbon.DateMilli 类型别名和 carbon.NewDateMilli 方法

  • 新增 carbon.DateMicro 类型别名和 carbon.NewDateMicro 方法

  • 新增 carbon.DateNano 类型别名和 carbon.NewDateNano 方法

  • 新增 carbon.Time 类型别名和 carbon.NewTime 方法

  • 新增 carbon.TimeMilli 类型别名和 carbon.NewTimeMilli 方法

  • 新增 carbon.TimeMicro 类型别名和 carbon.NewTimeMicro 方法

  • 新增 carbon.TimeNano 类型别名和 carbon.NewTimeNano 方法

v2.6.3

21 Apr 01:24
Compare
Choose a tag to compare
English
  • Fix bug with the same results in different countries using IsWeekend and IsWeekday methods.
  • Fix bug carbon.Parse("").StdTime() cause a nil pointer panic. #294
  • Change errors from private method to public method.
  • Change the default start date of the week from Sunday to Monday
  • Change the year of MinValue from -9998 to 1
  • Change weeksPerLongYear constant to WeeksPerLongYear
  • 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.
中文
  • 修复 IsWeekend, IsWeekday 方法不同国家返回结果一致的 bug
  • 修复 StdTime 方法空指针引起的异常 #294
  • 将错误方法由 私有 方法改成 公开 方法
  • 将一周默认开始日期从 周日 改成 周一
  • MinValue 方法的年份从 -9998 更改为 1
  • weeksPerLongYear 常量更名为 WeeksPerLongYear
  • 新增性能测试文件 xxx_bench_test.go
  • 新增 IsEpoch 方法用于判断是否是 UNIX 纪元时间(1970-01-01 00:00:00 +0000 UTC)
  • 新增 WeekEndsAt 方法用于获取一周的结束日期
  • 新增 SetWeekendDays 方法用于设置一周周末日期
  • 新增 DefaultWeekStartsAt 全局变量用于存储默认一周休息日

v2.5.8

13 Apr 13:14
Compare
Choose a tag to compare
English
  • Fix bug with the same results in different countries using IsWeekend and IsWeekday methods.
  • Change errors from private method to public method.
  • Change the default start date of the week from Sunday to Monday
  • Change the year of MinValue from -9998 to 1
  • Change weeksPerLongYear constant to WeeksPerLongYear
  • 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.
中文
  • 修复 IsWeekend, IsWeekday 方法不同国家返回结果一致的 bug
  • 将错误方法由 私有 方法改成 公开 方法
  • 将一周默认开始日期从 周日 改成 周一
  • MinValue 方法的年份从 -9998 更改为 1
  • weeksPerLongYear 常量更名为 WeeksPerLongYear
  • 新增 IsEpoch 方法用于判断是否是 UNIX 纪元时间(1970-01-01 00:00:00 +0000 UTC)
  • 新增 WeekEndsAt 方法用于获取一周的结束日期
  • 新增 SetWeekendDays 方法用于设置一周周末日期
  • 新增 DefaultWeekStartsAt 全局变量用于存储默认一周休息日

v2.6.2

08 Apr 02:15
Compare
Choose a tag to compare
English
  • Remove hour, Minute,second parameter in CreateFromLunar,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 and AtomLayout return inconsistent value
  • Fix bug of RFC3339Format and RFC3339Layout 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 and TimestampNanoLayout constants
  • Add TimestampFormat, TimestampMilliFormat, TimestampMicroFormat and TimestampNanoFormat constants
  • Add DateTimeMilli, DateTimeMicro, DateTimeNano field types
  • Add DateMilliDateMicroDateNano field types
  • Add TimeMilliTimeMicroTimeNano 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
中文
  • CreateFromLunar, CreateFromPersian 方法去掉 hour, minute, second 参数
  • 更改部分格式符号定义,涉及到的符号有 U, V, X,S,T Z,u,v,x,z
  • 修复农历中 IsLeapMonth 判断错误的 bug
  • 修复 AtomFormatAtomLayout 格式返回值不一致的 bug
  • 修复 RFC3339FormatRFC3339Layout 格式返回值不一致的 bug
  • 设置全局默认时区时不再同步更新 time.Local
  • 新增格式符号o 来获取时区偏移量
  • 新增 TimestampLayoutTimestampMilliLayoutTimestampMicroLayoutTimestampNanoLayout 常量
  • 新增 TimestampFormatTimestampMilliFormatTimestampMicroFormatTimestampNanoFormat 常量
  • 新增 DateTimeMilliDateTimeMicroDateTimeNano 字段类型
  • 新增 DateMilliDateMicroDateNano 字段类型
  • 新增 TimeMilliTimeMicroTimeNano 字段类型
  • 修复 IsDST 方法丢失时区的 bug
  • 修复 StartOfXXXEndOfXXX 部分方法丢失时区的 bug
  • 修复其他日历转化为公历时缺失时区的 bug
  • 设置默认时区时不再同步更新 time.Local
  • 新增 MaxDurationMinDuration 方法

v2.5.6

08 Apr 11:35
Compare
Choose a tag to compare
test: nil loc -> nil location

v2.5.5

02 Apr 06:36
Compare
Choose a tag to compare
English
  • golang minimum version dependency upgraded to 1.18

  • Change default global timezone from Local to UTC

  • Remove hour, Minute,second parameter in CreateFromLunar,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 and AtomLayout return inconsistent value

  • Fix bug of RFC3339Format and RFC3339Layout return inconsistent value

  • Fix missing timezone bug in IsDST method

  • Fix missing timezone bug StartOfXXX, EndOfXXX methods

  • 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

  • Add ZoneName method to get the time zone name

  • Add HasError method to check if there is an error

  • Add WeekStartsAt method to get start day of the week

  • Add ParseWithLayouts and ParseWithFormats methods

  • Add format symbol o to get time zone offset

中文
  • golang 最低版本依赖升级到 1.18

  • 默认全局时区从 Local 更改为 UTC

  • CreateFromLunar, CreateFromPersian 方法去掉 hour, minute, second 参数

  • 更改部分格式符号定义,涉及到的符号有 U, V, X,S,T Z,u,v,x,z

  • 修复 IsDST 方法丢失时区的 bug

  • 修复 StartOfXXXEndOfXXX 部分方法丢失时区的 bug

  • 修复农历中 IsLeapMonth 判断错误的 bug

  • 修复 AtomFormatAtomLayout 格式返回值不一致的 bug

  • 修复 RFC3339FormatRFC3339Layout 格式返回值不一致的 bug

  • Offset 方法更名为 ZoneOffset

  • IsSetTestNow 方法更名为 IsTestNow

  • UnSetTestNow 方法更名为 CleanTestNow

  • 移除 Location 方法,由 Timezone 方法替代

  • 更改 IsValidIsInvalid 方法判断逻辑,zero time 不再视为无效时间

  • 新增 ZoneName 方法获取时区名称

  • 新增 HasError 方法判断是否有错误

  • 新增 WeekStartsAt 方法获取周起始日期

  • 新增 ParseWithLayoutsParseWithFormats 方法

  • 新增格式符号o 来获取时区偏移量

v2.6.2-rc1

31 Mar 02:11
Compare
Choose a tag to compare
English
  • Remove hour, Minute,second parameter in CreateFromLunar,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 and AtomLayout return inconsistent value
  • Fix bug of RFC3339Format and RFC3339Layout 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 and TimestampNanoLayout constants
  • Add TimestampFormat, TimestampMilliFormat, TimestampMicroFormat and TimestampNanoFormat constants
  • Add DateTimeMilli, DateTimeMicro, DateTimeNano field types
  • Add DateMilliDateMicroDateNano field types
  • Add TimeMilliTimeMicroTimeNano field types
中文
  • CreateFromLunar, CreateFromPersian 方法去掉 hour, minute, second 参数
  • 更改部分格式符号定义,涉及到的符号有 U, V, X,S,T Z,u,v,x,z
  • 修复农历中 IsLeapMonth 判断错误的 bug
  • 修复 AtomFormatAtomLayout 格式返回值不一致的 bug
  • 修复 RFC3339FormatRFC3339Layout 格式返回值不一致的 bug
  • 设置全局默认时区时不再同步更新 time.Local
  • 新增格式符号o 来获取时区偏移量
  • 新增 TimestampLayoutTimestampMilliLayoutTimestampMicroLayoutTimestampNanoLayout 常量
  • 新增 TimestampFormatTimestampMilliFormatTimestampMicroFormatTimestampNanoFormat 常量
  • 新增 DateTimeMilliDateTimeMicroDateTimeNano 字段类型
  • 新增 DateMilliDateMicroDateNano 字段类型
  • 新增 TimeMilliTimeMicroTimeNano 字段类型

v2.6.1

27 Mar 01:58
Compare
Choose a tag to compare
English
  • Add ParseWithLayouts and ParseWithFormats methods
  • Rename formatFactory interface to FormatFactory, formatFactory interface to FormatFactory, formatFactory interface to FormatFactory, and add type constraints
  • Change the return value of the GormDataType method of the LayoutType, FormatType, TimestampType struct to time
  • Change DateTime, Date, Time types from struct to string
  • Change TimestampTimestampMilliTimestampMicro,TimestampNano types from struct to int64
  • Move built-in database field types to new file types.go
  • Fixed updated_at field is automatically updated and invalid when gorm updates data
中文
  • 新增 ParseWithLayoutsParseWithFormats 方法
  • formatFactory 接口更名为 FormatFactory, formatFactory 接口更名为 FormatFactory, formatFactory 接口更名为 FormatFactory, 并添加类型约束
  • LayoutType ,FormatType, TimestampType 结构体GormDataType 方法的返回值更改为 time
  • DateTimeDateTime 类型从 struct 更改为 string
  • TimestampTimestampMilliTimestampMicro,TimestampNano 类型从 struct 更改为 int64
  • 将内置数据库字段类型移动到新文件 types.go
  • 修复 gorm 更新数据时 updated_at 字段自动更新无效的 bug