First implementation of an atom feed
This commit is contained in:
23
date.go
Normal file
23
date.go
Normal file
@@ -0,0 +1,23 @@
|
||||
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))
|
||||
}
|
Reference in New Issue
Block a user