Iso8601.js 1.6 KB

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