//UnmarshalJSON returns result of Unmarshal for json.Unmarshal()
UnmarshalJSON returns result of Unmarshal for json.Unmarshal()
// UnmarshalJSON returns result of Unmarshal for json . Unmarshal ()
func (t *Date) UnmarshalJSON(b []byte) error {
	s, err := strconv.Unquote(string(b))
	if err != nil {
		s = string(b)
	}
	if len(s) == 0 || strings.ToLower(s) == "null" {
		*t = Date{time.Time{}}
		return nil
	}
	if strings.Contains(s, "-") {
		var lastErr error
		for _, tmplt := range timeTemplate1 {
			if tm, err := time.Parse(tmplt, s); err != nil {
				lastErr = errs.Wrap(err, errs.WithContext("time_string", s), errs.WithContext("time_template", tmplt))
			} else {
				*t = Date{tm}
				return nil
			}
		}
		return lastErr
	}
	var lastErr error
	for _, tmplt := range timeTemplate2 {
		if tm, err := time.Parse(tmplt, s); err != nil {
			lastErr = errs.Wrap(err, errs.WithContext("time_string", s), errs.WithContext("time_template", tmplt))
		} else {
			*t = Date{tm}
			return nil
		}
	}
	return lastErr
}
func ( t * Date ) UnmarshalJSON ( b [ ] byte ) error { s , err := strconv . Unquote ( string ( b ) ) if err != nil { s = string ( b ) } if len ( s ) == 0 || strings . ToLower ( s ) == " " { * t = Date { time . Time { } } return nil } if strings . Contains ( s , " " ) { var lastErr error for _ , tmplt := range timeTemplate1 { if tm , err := time . Parse ( tmplt , s ) ; err != nil { lastErr = errs . Wrap ( err , errs . WithContext ( " " , s ) , errs . WithContext ( " " , tmplt ) ) } else { * t = Date { tm } return nil } } return lastErr } var lastErr error for _ , tmplt := range timeTemplate2 { if tm , err := time . Parse ( tmplt , s ) ; err != nil { lastErr = errs . Wrap ( err , errs . WithContext ( " " , s ) , errs . WithContext ( " " , tmplt ) ) } else { * t = Date { tm } return nil } } return lastErr }
UnmarshalJSON returns result of Unmarshal for json.Unmarshal()
UnmarshalJSON returns result of Unmarshal for json . Unmarshal ()