Merge pull request #9414 from ZhangShuaiyi/fix/tomlext_MarshalText

tomlext.Duration add MarshalText method
This commit is contained in:
Maksym Pavlenko 2023-12-01 22:36:53 +00:00 committed by GitHub
commit e2303c267e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,6 +29,10 @@ func (d *Duration) UnmarshalText(b []byte) error {
return nil return nil
} }
func (d Duration) MarshalText() (text []byte, err error) {
return []byte(time.Duration(d).String()), nil
}
func ToStdTime(d Duration) time.Duration { func ToStdTime(d Duration) time.Duration {
return time.Duration(d) return time.Duration(d)
} }