24 lines
314 B
Go
24 lines
314 B
Go
|
package atomfeed
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
type Date struct {
|
||
|
*CommonAttributes
|
||
|
DateTime string
|
||
|
}
|
||
|
|
||
|
func (d *Date) Check() error {
|
||
|
if d.DateTime == "" {
|
||
|
return errors.New("date time element of date is empty")
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func DateTime(t time.Time) string {
|
||
|
return string(t.Format(time.RFC3339))
|
||
|
}
|