Iso8601.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import JulianDate from "./JulianDate.js";
  2. import TimeInterval from "./TimeInterval.js";
  3. const MINIMUM_VALUE = Object.freeze(
  4. JulianDate.fromIso8601("0000-01-01T00:00:00Z")
  5. );
  6. const MAXIMUM_VALUE = Object.freeze(
  7. JulianDate.fromIso8601("9999-12-31T24:00:00Z")
  8. );
  9. const MAXIMUM_INTERVAL = Object.freeze(
  10. new TimeInterval({
  11. start: MINIMUM_VALUE,
  12. stop: MAXIMUM_VALUE,
  13. })
  14. );
  15. /**
  16. * Constants related to ISO8601 support.
  17. *
  18. * @namespace
  19. *
  20. * @see {@link http://en.wikipedia.org/wiki/ISO_8601|ISO 8601 on Wikipedia}
  21. * @see JulianDate
  22. * @see TimeInterval
  23. */
  24. const Iso8601 = {
  25. /**
  26. * A {@link JulianDate} representing the earliest time representable by an ISO8601 date.
  27. * This is equivalent to the date string '0000-01-01T00:00:00Z'
  28. *
  29. * @type {JulianDate}
  30. * @constant
  31. */
  32. MINIMUM_VALUE: MINIMUM_VALUE,
  33. /**
  34. * A {@link JulianDate} representing the latest time representable by an ISO8601 date.
  35. * This is equivalent to the date string '9999-12-31T24:00:00Z'
  36. *
  37. * @type {JulianDate}
  38. * @constant
  39. */
  40. MAXIMUM_VALUE: MAXIMUM_VALUE,
  41. /**
  42. * A {@link TimeInterval} representing the largest interval representable by an ISO8601 interval.
  43. * This is equivalent to the interval string '0000-01-01T00:00:00Z/9999-12-31T24:00:00Z'
  44. *
  45. * @type {TimeInterval}
  46. * @constant
  47. */
  48. MAXIMUM_INTERVAL: MAXIMUM_INTERVAL,
  49. };
  50. export default Iso8601;