diff --git a/date.go b/date.go index 486a754..008fb3e 100644 --- a/date.go +++ b/date.go @@ -10,6 +10,14 @@ type Date struct { DateTime string } +func DateTime(t time.Time) string { + return string(t.Format(time.RFC3339)) +} + +func NewDate(t time.Time) *Date { + return &Date{DateTime: DateTime(t)} +} + func (d *Date) Check() error { if d.DateTime == "" { return errors.New("date time element of date is empty") @@ -17,7 +25,3 @@ func (d *Date) Check() error { return nil } - -func DateTime(t time.Time) string { - return string(t.Format(time.RFC3339)) -}