18 lines
320 B
Go
18 lines
320 B
Go
|
package api
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
type IDFMTime time.Time
|
||
|
|
||
|
func (t *IDFMTime) UnmarshalJSON(b []byte) error {
|
||
|
tmp, err := time.Parse("\"2006-01-02T15:04\"", string(b))
|
||
|
*t = IDFMTime(tmp)
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
func (t IDFMTime) MarshalJSON() ([]byte, error) {
|
||
|
return []byte(time.Time(t).Format("\"2006-01-02T15:04\"")), nil
|
||
|
}
|