21
0
Fork 0

v0.0.405
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m36s Details

This commit is contained in:
Mike Schwörer 2024-03-10 15:28:26 +01:00
parent 102a280dda
commit 0927fdc4d7
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 7 additions and 23 deletions

View File

@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.404"
const GoextVersion = "0.0.405"
const GoextVersionTimestamp = "2024-03-10T15:25:30+0100"
const GoextVersionTimestamp = "2024-03-10T15:28:26+0100"

View File

@ -67,36 +67,20 @@ func (t *Date) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(data, &str); err != nil {
return err
}
t0, err := time.Parse(t.FormatStr(), str)
if err != nil {
return err
}
t.Year = t0.Year()
t.Month = int(t0.Month())
t.Day = t0.Day()
return nil
return t.ParseString(str)
}
func (t Date) MarshalJSON() ([]byte, error) {
str := t.TimeUTC().Format(t.FormatStr())
str := t.String()
return json.Marshal(str)
}
func (t Date) MarshalText() ([]byte, error) {
b := make([]byte, 0, len(t.FormatStr()))
return t.TimeUTC().AppendFormat(b, t.FormatStr()), nil
return []byte(t.String()), nil
}
func (t *Date) UnmarshalText(data []byte) error {
var err error
v, err := time.Parse(t.FormatStr(), string(data))
if err != nil {
return err
}
t.Year = v.Year()
t.Month = int(v.Month())
t.Day = v.Day()
return nil
return t.ParseString(string(data))
}
func (t *Date) UnmarshalBSONValue(bt bsontype.Type, data []byte) error {
@ -166,7 +150,7 @@ func (t Date) DecodeValue(dc bsoncodec.DecodeContext, vr bsonrw.ValueReader, val
}
func (t Date) Serialize() string {
return t.TimeUTC().Format(t.FormatStr())
return t.String()
}
func (t Date) FormatStr() string {