json_time.go 307 B

123456789
  1. package service
  2. import "time"
  3. // isJSONTimeInRange rejects dates that PostgreSQL can store but time.Time cannot
  4. // serialize in API responses. Nil represents an unset schedule or expiry.
  5. func isJSONTimeInRange(value *time.Time) bool {
  6. return value == nil || (value.Year() >= 0 && value.Year() <= 9999)
  7. }