Added and corrected comments
This commit is contained in:
5
date.go
5
date.go
@@ -10,14 +10,19 @@ type Date struct {
|
||||
DateTime string
|
||||
}
|
||||
|
||||
// DateTime formats a time.Time to string formated as defined by RFC3339. It
|
||||
// returns a string.
|
||||
func DateTime(t time.Time) string {
|
||||
return string(t.Format(time.RFC3339))
|
||||
}
|
||||
|
||||
// NewDate creates a new Date. It returns a *Date.
|
||||
func NewDate(t time.Time) *Date {
|
||||
return &Date{DateTime: DateTime(t)}
|
||||
}
|
||||
|
||||
// Check checks the Date for incompatibilities with RFC4287. It returns an
|
||||
// error.
|
||||
func (d *Date) Check() error {
|
||||
if d.DateTime == "" {
|
||||
return errors.New("date time element of date is empty")
|
||||
|
Reference in New Issue
Block a user