optionalRelaxedTime returns t as a *RelaxedTime, or nil if t is the zero time. It is used for optional time attributes, so that MarshalXML leaves out an unset time as Element does, instead of writing "0001-01-01T00:00:00Z" (which reads as long expired).
(t time.Time)
| 21 | // out an unset time as Element does, instead of writing |
| 22 | // "0001-01-01T00:00:00Z" (which reads as long expired). |
| 23 | func optionalRelaxedTime(t time.Time) *RelaxedTime { |
| 24 | if t.IsZero() { |
| 25 | return nil |
| 26 | } |
| 27 | rt := RelaxedTime(t) |
| 28 | return &rt |
| 29 | } |
| 30 | |
| 31 | // MarshalText implements encoding.TextMarshaler |
| 32 | func (m RelaxedTime) MarshalText() ([]byte, error) { |
no test coverage detected