parseDate parses as defined in https://httpwg.org/specs/rfc9651.html#parse-date.
(s *scanner)
| 22 | // parseDate parses as defined in |
| 23 | // https://httpwg.org/specs/rfc9651.html#parse-date. |
| 24 | func parseDate(s *scanner) (time.Time, error) { |
| 25 | if s.eof() || s.data[s.off] != '@' { |
| 26 | return time.Time{}, &UnmarshalError{s.off, ErrInvalidDateFormat} |
| 27 | } |
| 28 | s.off++ |
| 29 | |
| 30 | n, err := parseNumber(s) |
| 31 | if err != nil { |
| 32 | return time.Time{}, &UnmarshalError{s.off, ErrInvalidDateFormat} |
| 33 | } |
| 34 | |
| 35 | i, ok := n.(int64) |
| 36 | if !ok { |
| 37 | return time.Time{}, &UnmarshalError{s.off, ErrInvalidDateFormat} |
| 38 | } |
| 39 | |
| 40 | return time.Unix(i, 0), nil |
| 41 | } |
searching dependent graphs…