2022-10-22 22:56:24 +00:00
|
|
|
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
|
|
|
|
}
|
2022-10-23 08:59:56 +00:00
|
|
|
|
|
|
|
func (t *IDFMTime) After(d IDFMTime) bool {
|
|
|
|
return time.Time(*t).After(time.Time(d))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t IDFMTime) String() string {
|
|
|
|
return time.Time(t).String()
|
|
|
|
}
|