GregorianDate.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. * Represents a Gregorian date in a more precise format than the JavaScript Date object.
  3. * In addition to submillisecond precision, this object can also represent leap seconds.
  4. * @alias GregorianDate
  5. * @constructor
  6. *
  7. * @param {Number} [year] The year as a whole number.
  8. * @param {Number} [month] The month as a whole number with range [1, 12].
  9. * @param {Number} [day] The day of the month as a whole number starting at 1.
  10. * @param {Number} [hour] The hour as a whole number with range [0, 23].
  11. * @param {Number} [minute] The minute of the hour as a whole number with range [0, 59].
  12. * @param {Number} [second] The second of the minute as a whole number with range [0, 60], with 60 representing a leap second.
  13. * @param {Number} [millisecond] The millisecond of the second as a floating point number with range [0.0, 1000.0).
  14. * @param {Boolean} [isLeapSecond] Whether this time is during a leap second.
  15. *
  16. * @see JulianDate#toGregorianDate
  17. */
  18. function GregorianDate(
  19. year,
  20. month,
  21. day,
  22. hour,
  23. minute,
  24. second,
  25. millisecond,
  26. isLeapSecond
  27. ) {
  28. /**
  29. * Gets or sets the year as a whole number.
  30. * @type {Number}
  31. */
  32. this.year = year;
  33. /**
  34. * Gets or sets the month as a whole number with range [1, 12].
  35. * @type {Number}
  36. */
  37. this.month = month;
  38. /**
  39. * Gets or sets the day of the month as a whole number starting at 1.
  40. * @type {Number}
  41. */
  42. this.day = day;
  43. /**
  44. * Gets or sets the hour as a whole number with range [0, 23].
  45. * @type {Number}
  46. */
  47. this.hour = hour;
  48. /**
  49. * Gets or sets the minute of the hour as a whole number with range [0, 59].
  50. * @type {Number}
  51. */
  52. this.minute = minute;
  53. /**
  54. * Gets or sets the second of the minute as a whole number with range [0, 60], with 60 representing a leap second.
  55. * @type {Number}
  56. */
  57. this.second = second;
  58. /**
  59. * Gets or sets the millisecond of the second as a floating point number with range [0.0, 1000.0).
  60. * @type {Number}
  61. */
  62. this.millisecond = millisecond;
  63. /**
  64. * Gets or sets whether this time is during a leap second.
  65. * @type {Boolean}
  66. */
  67. this.isLeapSecond = isLeapSecond;
  68. }
  69. export default GregorianDate;