Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 | 1x 1x 1x 1983302x 1x 455246x 455246x 455246x 455246x 455246x 455246x 15011x 455246x 455246x 18287x 18287x 3231x 3231x 455246x 1806x 1806x 1806x 1806x 1802x 1806x 86x 1720x 1505x 215x 215x 4x 211x 2x 209x 1444581x 1444581x 1444581x 1444581x 257x 257x 1444581x 1444581x 1444581x 18164x 18164x 18164x 18164x 18164x 1995x 18164x 18164x 1995x 18164x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 463563x 463563x 463563x 463563x 463563x 463563x 463563x 463563x 463563x 453528x 1x 90x 90x 90x 1x 89x 89x 89x 1x 14924x 2x 14922x 14922x 13294x 1628x 1628x 1628x 1x 3192x 1x 3191x 3191x 3191x 3191x 3191x 3191x 3191x 3191x 3191x 3191x 3191x 3191x 3191x 3099x 3099x 2x 3097x 3097x 3097x 92x 92x 1x 1x 91x 91x 72x 19x 19x 5x 5x 5x 5x 2x 14x 14x 6x 6x 6x 6x 6x 2x 4x 4x 8x 7x 7x 7x 7x 3177x 3177x 16x 3161x 2852x 2852x 2810x 2810x 2x 2808x 2808x 2808x 2808x 2808x 42x 42x 33x 33x 33x 33x 33x 33x 9x 9x 6x 6x 6x 3x 2847x 4x 2843x 2843x 2843x 2843x 77x 77x 77x 5x 5x 5x 2725x 36x 36x 3152x 3152x 5x 3152x 3152x 23x 23x 3152x 3152x 22x 22x 22x 21x 21x 22x 3152x 1x 1x 3152x 73x 73x 3152x 3x 3x 2x 2x 3x 3x 3152x 3152x 3151x 1x 1x 3152x 5x 3152x 1x 14333x 1x 1x 1804x 1804x 1804x 1804x 2x 2x 2x 1804x 1804x 1804x 862x 1804x 1804x 1804x 1804x 1804x 1804x 1804x 1804x 1804x 1804x 1804x 1804x 1804x 1804x 1804x 1804x 1804x 1804x 862x 1804x 2x 1804x 1161x 643x 643x 643x 643x 643x 643x 643x 643x 643x 1x 20x 20x 20x 20x 1x 20x 1x 533x 533x 533x 533x 533x 533x 533x 533x 533x 533x 7x 7x 7x 7x 533x 226x 226x 226x 307x 297x 10x 10x 1x 33388x 86x 33302x 9679x 23623x 23623x 23623x 1x 2246711x 2246711x 2246711x 2246711x 1988534x 258177x 1x 207010x 1x 16x 16x 1x 39231x 39231x 1x 27947x 27947x 27947x 27947x 1x 13314x 13314x 13314x 13314x 13314x 1x 27021x 27021x 27021x 27021x 27020x 27020x 27020x 18x 27021x 1x 979067x 979067x 1x 979066x 979066x 1x 3x 3x 1x 2x 2x 2x 1x 8x 8x 1x 7x 7x 7x 1x 226x 226x 1x 225x 225x 225x 1x 8178x 1x 400x 1x 17176x 1x 8183x 1x 78x 1x 204238x 1x 3x 1x 233x 1x | import binarySearch from "./binarySearch.js";
import defined from "./defined.js";
import DeveloperError from "./DeveloperError.js";
import GregorianDate from "./GregorianDate.js";
import isLeapYear from "./isLeapYear.js";
import LeapSecond from "./LeapSecond.js";
import TimeConstants from "./TimeConstants.js";
import TimeStandard from "./TimeStandard.js";
const gregorianDateScratch = new GregorianDate();
const daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
const daysInLeapFebruary = 29;
function compareLeapSecondDates(leapSecond, dateToFind) {
return JulianDate.compare(leapSecond.julianDate, dateToFind.julianDate);
}
// we don't really need a leap second instance, anything with a julianDate property will do
const binarySearchScratchLeapSecond = new LeapSecond();
function convertUtcToTai(julianDate) {
//Even though julianDate is in UTC, we'll treat it as TAI and
//search the leap second table for it.
binarySearchScratchLeapSecond.julianDate = julianDate;
const leapSeconds = JulianDate.leapSeconds;
let index = binarySearch(
leapSeconds,
binarySearchScratchLeapSecond,
compareLeapSecondDates,
);
Eif (index < 0) {
index = ~index;
}
if (index >= leapSeconds.length) {
index = leapSeconds.length - 1;
}
let offset = leapSeconds[index].offset;
if (index > 0) {
//Now we have the index of the closest leap second that comes on or after our UTC time.
//However, if the difference between the UTC date being converted and the TAI
//defined leap second is greater than the offset, we are off by one and need to use
//the previous leap second.
const difference = JulianDate.secondsDifference(
leapSeconds[index].julianDate,
julianDate,
);
if (difference > offset) {
index--;
offset = leapSeconds[index].offset;
}
}
JulianDate.addSeconds(julianDate, offset, julianDate);
}
function convertTaiToUtc(julianDate, result) {
binarySearchScratchLeapSecond.julianDate = julianDate;
const leapSeconds = JulianDate.leapSeconds;
let index = binarySearch(
leapSeconds,
binarySearchScratchLeapSecond,
compareLeapSecondDates,
);
if (index < 0) {
index = ~index;
}
//All times before our first leap second get the first offset.
if (index === 0) {
return JulianDate.addSeconds(julianDate, -leapSeconds[0].offset, result);
}
//All times after our leap second get the last offset.
if (index >= leapSeconds.length) {
return JulianDate.addSeconds(
julianDate,
-leapSeconds[index - 1].offset,
result,
);
}
//Compute the difference between the found leap second and the time we are converting.
const difference = JulianDate.secondsDifference(
leapSeconds[index].julianDate,
julianDate,
);
if (difference === 0) {
//The date is in our leap second table.
return JulianDate.addSeconds(
julianDate,
-leapSeconds[index].offset,
result,
);
}
if (difference <= 1.0) {
//The requested date is during the moment of a leap second, then we cannot convert to UTC
return undefined;
}
//The time is in between two leap seconds, index is the leap second after the date
//we're converting, so we subtract one to get the correct LeapSecond instance.
return JulianDate.addSeconds(
julianDate,
-leapSeconds[--index].offset,
result,
);
}
function setComponents(wholeDays, secondsOfDay, julianDate) {
const extraDays = (secondsOfDay / TimeConstants.SECONDS_PER_DAY) | 0;
wholeDays += extraDays;
secondsOfDay -= TimeConstants.SECONDS_PER_DAY * extraDays;
if (secondsOfDay < 0) {
wholeDays--;
secondsOfDay += TimeConstants.SECONDS_PER_DAY;
}
julianDate.dayNumber = wholeDays;
julianDate.secondsOfDay = secondsOfDay;
return julianDate;
}
function computeJulianDateComponents(
year,
month,
day,
hour,
minute,
second,
millisecond,
) {
// Algorithm from page 604 of the Explanatory Supplement to the
// Astronomical Almanac (Seidelmann 1992).
const a = ((month - 14) / 12) | 0;
const b = year + 4800 + a;
let dayNumber =
(((1461 * b) / 4) | 0) +
(((367 * (month - 2 - 12 * a)) / 12) | 0) -
(((3 * (((b + 100) / 100) | 0)) / 4) | 0) +
day -
32075;
// JulianDates are noon-based
hour = hour - 12;
if (hour < 0) {
hour += 24;
}
const secondsOfDay =
second +
(hour * TimeConstants.SECONDS_PER_HOUR +
minute * TimeConstants.SECONDS_PER_MINUTE +
millisecond * TimeConstants.SECONDS_PER_MILLISECOND);
if (secondsOfDay >= 43200.0) {
dayNumber -= 1;
}
return [dayNumber, secondsOfDay];
}
//Regular expressions used for ISO8601 date parsing.
//YYYY
const matchCalendarYear = /^(\d{4})$/;
//YYYY-MM (YYYYMM is invalid)
const matchCalendarMonth = /^(\d{4})-(\d{2})$/;
//YYYY-DDD or YYYYDDD
const matchOrdinalDate = /^(\d{4})-?(\d{3})$/;
//YYYY-Www or YYYYWww or YYYY-Www-D or YYYYWwwD
const matchWeekDate = /^(\d{4})-?W(\d{2})-?(\d{1})?$/;
//YYYY-MM-DD or YYYYMMDD
const matchCalendarDate = /^(\d{4})-?(\d{2})-?(\d{2})$/;
// Match utc offset
const utcOffset = /([Z+\-])?(\d{2})?:?(\d{2})?$/;
// Match hours HH or HH.xxxxx
const matchHours = /^(\d{2})(\.\d+)?/.source + utcOffset.source;
// Match hours/minutes HH:MM HHMM.xxxxx
const matchHoursMinutes = /^(\d{2}):?(\d{2})(\.\d+)?/.source + utcOffset.source;
// Match hours/minutes HH:MM:SS HHMMSS.xxxxx
const matchHoursMinutesSeconds =
/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source + utcOffset.source;
const iso8601ErrorMessage = "Invalid ISO 8601 date.";
/**
* Represents an astronomical Julian date, which is the number of days since noon on January 1, -4712 (4713 BC).
* For increased precision, this class stores the whole number part of the date and the seconds
* part of the date in separate components. In order to be safe for arithmetic and represent
* leap seconds, the date is always stored in the International Atomic Time standard
* {@link TimeStandard.TAI}.
* @alias JulianDate
* @constructor
*
* @param {number} [julianDayNumber=0.0] The Julian Day Number representing the number of whole days. Fractional days will also be handled correctly.
* @param {number} [secondsOfDay=0.0] The number of seconds into the current Julian Day Number. Fractional seconds, negative seconds and seconds greater than a day will be handled correctly.
* @param {TimeStandard} [timeStandard=TimeStandard.UTC] The time standard in which the first two parameters are defined.
*/
function JulianDate(julianDayNumber, secondsOfDay, timeStandard) {
/**
* Gets or sets the number of whole days.
* @type {number}
*/
this.dayNumber = undefined;
/**
* Gets or sets the number of seconds into the current day.
* @type {number}
*/
this.secondsOfDay = undefined;
julianDayNumber = julianDayNumber ?? 0.0;
secondsOfDay = secondsOfDay ?? 0.0;
timeStandard = timeStandard ?? TimeStandard.UTC;
//If julianDayNumber is fractional, make it an integer and add the number of seconds the fraction represented.
const wholeDays = julianDayNumber | 0;
secondsOfDay =
secondsOfDay +
(julianDayNumber - wholeDays) * TimeConstants.SECONDS_PER_DAY;
setComponents(wholeDays, secondsOfDay, this);
if (timeStandard === TimeStandard.UTC) {
convertUtcToTai(this);
}
}
/**
* Creates a new instance from a GregorianDate.
*
* @param {GregorianDate} date A GregorianDate.
* @param {JulianDate} [result] An existing instance to use for the result.
* @returns {JulianDate} The modified result parameter or a new instance if none was provided.
*
* @exception {DeveloperError} date must be a valid GregorianDate.
*/
JulianDate.fromGregorianDate = function (date, result) {
//>>includeStart('debug', pragmas.debug);
Iif (!(date instanceof GregorianDate)) {
throw new DeveloperError("date must be a valid GregorianDate.");
}
//>>includeEnd('debug');
const components = computeJulianDateComponents(
date.year,
date.month,
date.day,
date.hour,
date.minute,
date.second,
date.millisecond,
);
if (!defined(result)) {
return new JulianDate(components[0], components[1], TimeStandard.UTC);
}
setComponents(components[0], components[1], result);
convertUtcToTai(result);
return result;
};
/**
* Creates a new instance from a JavaScript Date.
*
* @param {Date} date A JavaScript Date.
* @param {JulianDate} [result] An existing instance to use for the result.
* @returns {JulianDate} The modified result parameter or a new instance if none was provided.
*
* @exception {DeveloperError} date must be a valid JavaScript Date.
*/
JulianDate.fromDate = function (date, result) {
//>>includeStart('debug', pragmas.debug);
if (!(date instanceof Date) || isNaN(date.getTime())) {
throw new DeveloperError("date must be a valid JavaScript Date.");
}
//>>includeEnd('debug');
const components = computeJulianDateComponents(
date.getUTCFullYear(),
date.getUTCMonth() + 1,
date.getUTCDate(),
date.getUTCHours(),
date.getUTCMinutes(),
date.getUTCSeconds(),
date.getUTCMilliseconds(),
);
if (!defined(result)) {
return new JulianDate(components[0], components[1], TimeStandard.UTC);
}
setComponents(components[0], components[1], result);
convertUtcToTai(result);
return result;
};
/**
* Creates a new instance from a from an {@link http://en.wikipedia.org/wiki/ISO_8601|ISO 8601} date.
* This method is superior to <code>Date.parse</code> because it will handle all valid formats defined by the ISO 8601
* specification, including leap seconds and sub-millisecond times, which discarded by most JavaScript implementations.
*
* @param {string} iso8601String An ISO 8601 date.
* @param {JulianDate} [result] An existing instance to use for the result.
* @returns {JulianDate} The modified result parameter or a new instance if none was provided.
*
* @exception {DeveloperError} Invalid ISO 8601 date.
*/
JulianDate.fromIso8601 = function (iso8601String, result) {
//>>includeStart('debug', pragmas.debug);
if (typeof iso8601String !== "string") {
throw new DeveloperError(iso8601ErrorMessage);
}
//>>includeEnd('debug');
//Comma and decimal point both indicate a fractional number according to ISO 8601,
//start out by blanket replacing , with . which is the only valid such symbol in JS.
iso8601String = iso8601String.replace(",", ".");
//Split the string into its date and time components, denoted by a mandatory T
let tokens = iso8601String.split("T");
let year;
let month = 1;
let day = 1;
let hour = 0;
let minute = 0;
let second = 0;
let millisecond = 0;
//Lacking a time is okay, but a missing date is illegal.
const date = tokens[0];
const time = tokens[1];
let tmp;
let inLeapYear;
//>>includeStart('debug', pragmas.debug);
Iif (!defined(date)) {
throw new DeveloperError(iso8601ErrorMessage);
}
let dashCount;
//>>includeEnd('debug');
//First match the date against possible regular expressions.
tokens = date.match(matchCalendarDate);
if (tokens !== null) {
//>>includeStart('debug', pragmas.debug);
dashCount = date.split("-").length - 1;
if (dashCount > 0 && dashCount !== 2) {
throw new DeveloperError(iso8601ErrorMessage);
}
//>>includeEnd('debug');
year = +tokens[1];
month = +tokens[2];
day = +tokens[3];
} else {
tokens = date.match(matchCalendarMonth);
if (tokens !== null) {
year = +tokens[1];
month = +tokens[2];
} else {
tokens = date.match(matchCalendarYear);
if (tokens !== null) {
year = +tokens[1];
} else {
//Not a year/month/day so it must be an ordinal date.
let dayOfYear;
tokens = date.match(matchOrdinalDate);
if (tokens !== null) {
year = +tokens[1];
dayOfYear = +tokens[2];
inLeapYear = isLeapYear(year);
//This validation is only applicable for this format.
//>>includeStart('debug', pragmas.debug);
if (
dayOfYear < 1 ||
(inLeapYear && dayOfYear > 366) ||
(!inLeapYear && dayOfYear > 365)
) {
throw new DeveloperError(iso8601ErrorMessage);
}
//>>includeEnd('debug');
} else {
tokens = date.match(matchWeekDate);
if (tokens !== null) {
//ISO week date to ordinal date from
//http://en.wikipedia.org/w/index.php?title=ISO_week_date&oldid=474176775
year = +tokens[1];
const weekNumber = +tokens[2];
const dayOfWeek = +tokens[3] || 0;
//>>includeStart('debug', pragmas.debug);
dashCount = date.split("-").length - 1;
if (
dashCount > 0 &&
((!defined(tokens[3]) && dashCount !== 1) ||
(defined(tokens[3]) && dashCount !== 2))
) {
throw new DeveloperError(iso8601ErrorMessage);
}
//>>includeEnd('debug');
const january4 = new Date(Date.UTC(year, 0, 4));
dayOfYear = weekNumber * 7 + dayOfWeek - january4.getUTCDay() - 3;
} else {
//None of our regular expressions succeeded in parsing the date properly.
//>>includeStart('debug', pragmas.debug);
throw new DeveloperError(iso8601ErrorMessage);
//>>includeEnd('debug');
}
}
//Split an ordinal date into month/day.
tmp = new Date(Date.UTC(year, 0, 1));
tmp.setUTCDate(dayOfYear);
month = tmp.getUTCMonth() + 1;
day = tmp.getUTCDate();
}
}
}
//Now that we have all of the date components, validate them to make sure nothing is out of range.
inLeapYear = isLeapYear(year);
//>>includeStart('debug', pragmas.debug);
if (
month < 1 ||
month > 12 ||
day < 1 ||
((month !== 2 || !inLeapYear) && day > daysInMonth[month - 1]) ||
(inLeapYear && month === 2 && day > daysInLeapFebruary)
) {
throw new DeveloperError(iso8601ErrorMessage);
}
//>>includeEnd('debug');
//Now move onto the time string, which is much simpler.
//If no time is specified, it is considered the beginning of the day, UTC to match Javascript's implementation.
let offsetIndex;
if (defined(time)) {
tokens = time.match(matchHoursMinutesSeconds);
if (tokens !== null) {
//>>includeStart('debug', pragmas.debug);
dashCount = time.split(":").length - 1;
if (dashCount > 0 && dashCount !== 2 && dashCount !== 3) {
throw new DeveloperError(iso8601ErrorMessage);
}
//>>includeEnd('debug');
hour = +tokens[1];
minute = +tokens[2];
second = +tokens[3];
millisecond = +(tokens[4] || 0) * 1000.0;
offsetIndex = 5;
} else {
tokens = time.match(matchHoursMinutes);
if (tokens !== null) {
//>>includeStart('debug', pragmas.debug);
dashCount = time.split(":").length - 1;
Iif (dashCount > 2) {
throw new DeveloperError(iso8601ErrorMessage);
}
//>>includeEnd('debug');
hour = +tokens[1];
minute = +tokens[2];
second = +(tokens[3] || 0) * 60.0;
offsetIndex = 4;
} else {
tokens = time.match(matchHours);
if (tokens !== null) {
hour = +tokens[1];
minute = +(tokens[2] || 0) * 60.0;
offsetIndex = 3;
} else {
//>>includeStart('debug', pragmas.debug);
throw new DeveloperError(iso8601ErrorMessage);
//>>includeEnd('debug');
}
}
}
//Validate that all values are in proper range. Minutes and hours have special cases at 60 and 24.
//>>includeStart('debug', pragmas.debug);
if (
minute >= 60 ||
second >= 61 ||
hour > 24 ||
(hour === 24 && (minute > 0 || second > 0 || millisecond > 0))
) {
throw new DeveloperError(iso8601ErrorMessage);
}
//>>includeEnd('debug');
//Check the UTC offset value, if no value exists, use local time
//a Z indicates UTC, + or - are offsets.
const offset = tokens[offsetIndex];
const offsetHours = +tokens[offsetIndex + 1];
const offsetMinutes = +(tokens[offsetIndex + 2] || 0);
switch (offset) {
case "+":
hour = hour - offsetHours;
minute = minute - offsetMinutes;
break;
case "-":
hour = hour + offsetHours;
minute = minute + offsetMinutes;
break;
case "Z":
break;
default:
minute =
minute +
new Date(
Date.UTC(year, month - 1, day, hour, minute),
).getTimezoneOffset();
break;
}
}
//ISO8601 denotes a leap second by any time having a seconds component of 60 seconds.
//If that's the case, we need to temporarily subtract a second in order to build a UTC date.
//Then we add it back in after converting to TAI.
const isLeapSecond = second === 60;
if (isLeapSecond) {
second--;
}
//Even if we successfully parsed the string into its components, after applying UTC offset or
//special cases like 24:00:00 denoting midnight, we need to normalize the data appropriately.
//milliseconds can never be greater than 1000, and seconds can't be above 60, so we start with minutes
while (minute >= 60) {
minute -= 60;
hour++;
}
while (hour >= 24) {
hour -= 24;
day++;
}
tmp = inLeapYear && month === 2 ? daysInLeapFebruary : daysInMonth[month - 1];
while (day > tmp) {
day -= tmp;
month++;
if (month > 12) {
month -= 12;
year++;
}
tmp =
inLeapYear && month === 2 ? daysInLeapFebruary : daysInMonth[month - 1];
}
//If UTC offset is at the beginning/end of the day, minutes can be negative.
while (minute < 0) {
minute += 60;
hour--;
}
while (hour < 0) {
hour += 24;
day--;
}
while (day < 1) {
month--;
if (month < 1) {
month += 12;
year--;
}
tmp =
inLeapYear && month === 2 ? daysInLeapFebruary : daysInMonth[month - 1];
day += tmp;
}
//Now create the JulianDate components from the Gregorian date and actually create our instance.
const components = computeJulianDateComponents(
year,
month,
day,
hour,
minute,
second,
millisecond,
);
if (!defined(result)) {
result = new JulianDate(components[0], components[1], TimeStandard.UTC);
} else {
setComponents(components[0], components[1], result);
convertUtcToTai(result);
}
//If we were on a leap second, add it back.
if (isLeapSecond) {
JulianDate.addSeconds(result, 1, result);
}
return result;
};
/**
* Creates a new instance that represents the current system time.
* This is equivalent to calling <code>JulianDate.fromDate(new Date());</code>.
*
* @param {JulianDate} [result] An existing instance to use for the result.
* @returns {JulianDate} The modified result parameter or a new instance if none was provided.
*/
JulianDate.now = function (result) {
return JulianDate.fromDate(new Date(), result);
};
const toGregorianDateScratch = new JulianDate(0, 0, TimeStandard.TAI);
/**
* Creates a {@link GregorianDate} from the provided instance.
*
* @param {JulianDate} julianDate The date to be converted.
* @param {GregorianDate} [result] An existing instance to use for the result.
* @returns {GregorianDate} The modified result parameter or a new instance if none was provided.
*/
JulianDate.toGregorianDate = function (julianDate, result) {
//>>includeStart('debug', pragmas.debug);
Iif (!defined(julianDate)) {
throw new DeveloperError("julianDate is required.");
}
//>>includeEnd('debug');
let isLeapSecond = false;
let thisUtc = convertTaiToUtc(julianDate, toGregorianDateScratch);
if (!defined(thisUtc)) {
//Conversion to UTC will fail if we are during a leap second.
//If that's the case, subtract a second and convert again.
//JavaScript doesn't support leap seconds, so this results in second 59 being repeated twice.
JulianDate.addSeconds(julianDate, -1, toGregorianDateScratch);
thisUtc = convertTaiToUtc(toGregorianDateScratch, toGregorianDateScratch);
isLeapSecond = true;
}
let julianDayNumber = thisUtc.dayNumber;
const secondsOfDay = thisUtc.secondsOfDay;
if (secondsOfDay >= 43200.0) {
julianDayNumber += 1;
}
// Algorithm from page 604 of the Explanatory Supplement to the
// Astronomical Almanac (Seidelmann 1992).
let L = (julianDayNumber + 68569) | 0;
const N = ((4 * L) / 146097) | 0;
L = (L - (((146097 * N + 3) / 4) | 0)) | 0;
const I = ((4000 * (L + 1)) / 1461001) | 0;
L = (L - (((1461 * I) / 4) | 0) + 31) | 0;
const J = ((80 * L) / 2447) | 0;
const day = (L - (((2447 * J) / 80) | 0)) | 0;
L = (J / 11) | 0;
const month = (J + 2 - 12 * L) | 0;
const year = (100 * (N - 49) + I + L) | 0;
let hour = (secondsOfDay / TimeConstants.SECONDS_PER_HOUR) | 0;
let remainingSeconds = secondsOfDay - hour * TimeConstants.SECONDS_PER_HOUR;
const minute = (remainingSeconds / TimeConstants.SECONDS_PER_MINUTE) | 0;
remainingSeconds =
remainingSeconds - minute * TimeConstants.SECONDS_PER_MINUTE;
let second = remainingSeconds | 0;
const millisecond =
(remainingSeconds - second) / TimeConstants.SECONDS_PER_MILLISECOND;
// JulianDates are noon-based
hour += 12;
if (hour > 23) {
hour -= 24;
}
//If we were on a leap second, add it back.
if (isLeapSecond) {
second += 1;
}
if (!defined(result)) {
return new GregorianDate(
year,
month,
day,
hour,
minute,
second,
millisecond,
isLeapSecond,
);
}
result.year = year;
result.month = month;
result.day = day;
result.hour = hour;
result.minute = minute;
result.second = second;
result.millisecond = millisecond;
result.isLeapSecond = isLeapSecond;
return result;
};
/**
* Creates a JavaScript Date from the provided instance.
* Since JavaScript dates are only accurate to the nearest millisecond and
* cannot represent a leap second, consider using {@link JulianDate.toGregorianDate} instead.
* If the provided JulianDate is during a leap second, the previous second is used.
*
* @param {JulianDate} julianDate The date to be converted.
* @returns {Date} A new instance representing the provided date.
*/
JulianDate.toDate = function (julianDate) {
//>>includeStart('debug', pragmas.debug);
Iif (!defined(julianDate)) {
throw new DeveloperError("julianDate is required.");
}
//>>includeEnd('debug');
const gDate = JulianDate.toGregorianDate(julianDate, gregorianDateScratch);
let second = gDate.second;
if (gDate.isLeapSecond) {
second -= 1;
}
return new Date(
Date.UTC(
gDate.year,
gDate.month - 1,
gDate.day,
gDate.hour,
gDate.minute,
second,
gDate.millisecond,
),
);
};
/**
* Creates an ISO8601 representation of the provided date.
*
* @param {JulianDate} julianDate The date to be converted.
* @param {number} [precision] The number of fractional digits used to represent the seconds component. By default, the most precise representation is used.
* @returns {string} The ISO8601 representation of the provided date.
*/
JulianDate.toIso8601 = function (julianDate, precision) {
//>>includeStart('debug', pragmas.debug);
Iif (!defined(julianDate)) {
throw new DeveloperError("julianDate is required.");
}
//>>includeEnd('debug');
const gDate = JulianDate.toGregorianDate(julianDate, gregorianDateScratch);
let year = gDate.year;
let month = gDate.month;
let day = gDate.day;
let hour = gDate.hour;
const minute = gDate.minute;
const second = gDate.second;
const millisecond = gDate.millisecond;
// special case - Iso8601.MAXIMUM_VALUE produces a string which we can't parse unless we adjust.
// 10000-01-01T00:00:00 is the same instant as 9999-12-31T24:00:00
if (
year === 10000 &&
month === 1 &&
day === 1 &&
hour === 0 &&
minute === 0 &&
second === 0 &&
millisecond === 0
) {
year = 9999;
month = 12;
day = 31;
hour = 24;
}
let millisecondStr;
if (!defined(precision) && millisecond !== 0) {
// Forces milliseconds into a number with at least 3 digits.
const millisecondHundreds = millisecond * 0.01;
// Below 1e-6, toString returns scientific notation, so it should be replaced by toFixed with appropriate number of digits.
// 20 digits is a trade-off choice guided by JavaScript's Number representation accuracy (15-17 decimal digits for most numbers).
// Using toFixed(20) ensures capturing enough precision while avoiding inaccuracies due to floating-point limitations.
millisecondStr =
millisecondHundreds < 1e-6
? millisecondHundreds.toFixed(20).replace(".", "").replace(/0+$/, "")
: millisecondHundreds.toString().replace(".", "");
return `${year.toString().padStart(4, "0")}-${month
.toString()
.padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour
.toString()
.padStart(2, "0")}:${minute.toString().padStart(2, "0")}:${second
.toString()
.padStart(2, "0")}.${millisecondStr}Z`;
}
//Precision is either 0 or milliseconds is 0 with undefined precision, in either case, leave off milliseconds entirely
if (!defined(precision) || precision === 0) {
return `${year.toString().padStart(4, "0")}-${month
.toString()
.padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour
.toString()
.padStart(2, "0")}:${minute
.toString()
.padStart(2, "0")}:${second.toString().padStart(2, "0")}Z`;
}
//Forces milliseconds into a number with at least 3 digits to whatever the specified precision is.
millisecondStr = (millisecond * 0.01)
.toFixed(precision)
.replace(".", "")
.slice(0, precision);
return `${year.toString().padStart(4, "0")}-${month
.toString()
.padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour
.toString()
.padStart(2, "0")}:${minute.toString().padStart(2, "0")}:${second
.toString()
.padStart(2, "0")}.${millisecondStr}Z`;
};
/**
* Duplicates a JulianDate instance.
*
* @param {JulianDate} julianDate The date to duplicate.
* @param {JulianDate} [result] An existing instance to use for the result.
* @returns {JulianDate} The modified result parameter or a new instance if none was provided. Returns undefined if julianDate is undefined.
*/
JulianDate.clone = function (julianDate, result) {
if (!defined(julianDate)) {
return undefined;
}
if (!defined(result)) {
return new JulianDate(
julianDate.dayNumber,
julianDate.secondsOfDay,
TimeStandard.TAI,
);
}
result.dayNumber = julianDate.dayNumber;
result.secondsOfDay = julianDate.secondsOfDay;
return result;
};
/**
* Compares two instances.
*
* @param {JulianDate} left The first instance.
* @param {JulianDate} right The second instance.
* @returns {number} A negative value if left is less than right, a positive value if left is greater than right, or zero if left and right are equal.
*/
JulianDate.compare = function (left, right) {
//>>includeStart('debug', pragmas.debug);
Iif (!defined(left)) {
throw new DeveloperError("left is required.");
}
Iif (!defined(right)) {
throw new DeveloperError("right is required.");
}
//>>includeEnd('debug');
const julianDayNumberDifference = left.dayNumber - right.dayNumber;
if (julianDayNumberDifference !== 0) {
return julianDayNumberDifference;
}
return left.secondsOfDay - right.secondsOfDay;
};
/**
* Compares two instances and returns <code>true</code> if they are equal, <code>false</code> otherwise.
*
* @param {JulianDate} [left] The first instance.
* @param {JulianDate} [right] The second instance.
* @returns {boolean} <code>true</code> if the dates are equal; otherwise, <code>false</code>.
*/
JulianDate.equals = function (left, right) {
return (
left === right ||
(defined(left) &&
defined(right) &&
left.dayNumber === right.dayNumber &&
left.secondsOfDay === right.secondsOfDay)
);
};
/**
* Compares two instances and returns <code>true</code> if they are within <code>epsilon</code> seconds of
* each other. That is, in order for the dates to be considered equal (and for
* this function to return <code>true</code>), the absolute value of the difference between them, in
* seconds, must be less than <code>epsilon</code>.
*
* @param {JulianDate} [left] The first instance.
* @param {JulianDate} [right] The second instance.
* @param {number} [epsilon=0] The maximum number of seconds that should separate the two instances.
* @returns {boolean} <code>true</code> if the two dates are within <code>epsilon</code> seconds of each other; otherwise <code>false</code>.
*/
JulianDate.equalsEpsilon = function (left, right, epsilon) {
epsilon = epsilon ?? 0;
return (
left === right ||
(defined(left) &&
defined(right) &&
Math.abs(JulianDate.secondsDifference(left, right)) <= epsilon)
);
};
/**
* Computes the total number of whole and fractional days represented by the provided instance.
*
* @param {JulianDate} julianDate The date.
* @returns {number} The Julian date as single floating point number.
*/
JulianDate.totalDays = function (julianDate) {
//>>includeStart('debug', pragmas.debug);
Iif (!defined(julianDate)) {
throw new DeveloperError("julianDate is required.");
}
//>>includeEnd('debug');
return (
julianDate.dayNumber +
julianDate.secondsOfDay / TimeConstants.SECONDS_PER_DAY
);
};
/**
* Computes the difference in seconds between the provided instance.
*
* @param {JulianDate} left The first instance.
* @param {JulianDate} right The second instance.
* @returns {number} The difference, in seconds, when subtracting <code>right</code> from <code>left</code>.
*/
JulianDate.secondsDifference = function (left, right) {
//>>includeStart('debug', pragmas.debug);
Iif (!defined(left)) {
throw new DeveloperError("left is required.");
}
Iif (!defined(right)) {
throw new DeveloperError("right is required.");
}
//>>includeEnd('debug');
const dayDifference =
(left.dayNumber - right.dayNumber) * TimeConstants.SECONDS_PER_DAY;
return dayDifference + (left.secondsOfDay - right.secondsOfDay);
};
/**
* Computes the difference in days between the provided instance.
*
* @param {JulianDate} left The first instance.
* @param {JulianDate} right The second instance.
* @returns {number} The difference, in days, when subtracting <code>right</code> from <code>left</code>.
*/
JulianDate.daysDifference = function (left, right) {
//>>includeStart('debug', pragmas.debug);
Iif (!defined(left)) {
throw new DeveloperError("left is required.");
}
Iif (!defined(right)) {
throw new DeveloperError("right is required.");
}
//>>includeEnd('debug');
const dayDifference = left.dayNumber - right.dayNumber;
const secondDifference =
(left.secondsOfDay - right.secondsOfDay) / TimeConstants.SECONDS_PER_DAY;
return dayDifference + secondDifference;
};
/**
* Computes the number of seconds the provided instance is ahead of UTC.
*
* @param {JulianDate} julianDate The date.
* @returns {number} The number of seconds the provided instance is ahead of UTC
*/
JulianDate.computeTaiMinusUtc = function (julianDate) {
binarySearchScratchLeapSecond.julianDate = julianDate;
const leapSeconds = JulianDate.leapSeconds;
let index = binarySearch(
leapSeconds,
binarySearchScratchLeapSecond,
compareLeapSecondDates,
);
if (index < 0) {
index = ~index;
--index;
if (index < 0) {
index = 0;
}
}
return leapSeconds[index].offset;
};
/**
* Adds the provided number of seconds to the provided date instance.
*
* @param {JulianDate} julianDate The date.
* @param {number} seconds The number of seconds to add or subtract.
* @param {JulianDate} result An existing instance to use for the result.
* @returns {JulianDate} The modified result parameter.
*/
JulianDate.addSeconds = function (julianDate, seconds, result) {
//>>includeStart('debug', pragmas.debug);
Iif (!defined(julianDate)) {
throw new DeveloperError("julianDate is required.");
}
if (!defined(seconds)) {
throw new DeveloperError("seconds is required.");
}
Iif (!defined(result)) {
throw new DeveloperError("result is required.");
}
//>>includeEnd('debug');
return setComponents(
julianDate.dayNumber,
julianDate.secondsOfDay + seconds,
result,
);
};
/**
* Adds the provided number of minutes to the provided date instance.
*
* @param {JulianDate} julianDate The date.
* @param {number} minutes The number of minutes to add or subtract.
* @param {JulianDate} result An existing instance to use for the result.
* @returns {JulianDate} The modified result parameter.
*/
JulianDate.addMinutes = function (julianDate, minutes, result) {
//>>includeStart('debug', pragmas.debug);
Iif (!defined(julianDate)) {
throw new DeveloperError("julianDate is required.");
}
if (!defined(minutes)) {
throw new DeveloperError("minutes is required.");
}
Iif (!defined(result)) {
throw new DeveloperError("result is required.");
}
//>>includeEnd('debug');
const newSecondsOfDay =
julianDate.secondsOfDay + minutes * TimeConstants.SECONDS_PER_MINUTE;
return setComponents(julianDate.dayNumber, newSecondsOfDay, result);
};
/**
* Adds the provided number of hours to the provided date instance.
*
* @param {JulianDate} julianDate The date.
* @param {number} hours The number of hours to add or subtract.
* @param {JulianDate} result An existing instance to use for the result.
* @returns {JulianDate} The modified result parameter.
*/
JulianDate.addHours = function (julianDate, hours, result) {
//>>includeStart('debug', pragmas.debug);
Iif (!defined(julianDate)) {
throw new DeveloperError("julianDate is required.");
}
if (!defined(hours)) {
throw new DeveloperError("hours is required.");
}
Iif (!defined(result)) {
throw new DeveloperError("result is required.");
}
//>>includeEnd('debug');
const newSecondsOfDay =
julianDate.secondsOfDay + hours * TimeConstants.SECONDS_PER_HOUR;
return setComponents(julianDate.dayNumber, newSecondsOfDay, result);
};
/**
* Adds the provided number of days to the provided date instance.
*
* @param {JulianDate} julianDate The date.
* @param {number} days The number of days to add or subtract.
* @param {JulianDate} result An existing instance to use for the result.
* @returns {JulianDate} The modified result parameter.
*/
JulianDate.addDays = function (julianDate, days, result) {
//>>includeStart('debug', pragmas.debug);
Iif (!defined(julianDate)) {
throw new DeveloperError("julianDate is required.");
}
if (!defined(days)) {
throw new DeveloperError("days is required.");
}
Iif (!defined(result)) {
throw new DeveloperError("result is required.");
}
//>>includeEnd('debug');
const newJulianDayNumber = julianDate.dayNumber + days;
return setComponents(newJulianDayNumber, julianDate.secondsOfDay, result);
};
/**
* Compares the provided instances and returns <code>true</code> if <code>left</code> is earlier than <code>right</code>, <code>false</code> otherwise.
*
* @param {JulianDate} left The first instance.
* @param {JulianDate} right The second instance.
* @returns {boolean} <code>true</code> if <code>left</code> is earlier than <code>right</code>, <code>false</code> otherwise.
*/
JulianDate.lessThan = function (left, right) {
return JulianDate.compare(left, right) < 0;
};
/**
* Compares the provided instances and returns <code>true</code> if <code>left</code> is earlier than or equal to <code>right</code>, <code>false</code> otherwise.
*
* @param {JulianDate} left The first instance.
* @param {JulianDate} right The second instance.
* @returns {boolean} <code>true</code> if <code>left</code> is earlier than or equal to <code>right</code>, <code>false</code> otherwise.
*/
JulianDate.lessThanOrEquals = function (left, right) {
return JulianDate.compare(left, right) <= 0;
};
/**
* Compares the provided instances and returns <code>true</code> if <code>left</code> is later than <code>right</code>, <code>false</code> otherwise.
*
* @param {JulianDate} left The first instance.
* @param {JulianDate} right The second instance.
* @returns {boolean} <code>true</code> if <code>left</code> is later than <code>right</code>, <code>false</code> otherwise.
*/
JulianDate.greaterThan = function (left, right) {
return JulianDate.compare(left, right) > 0;
};
/**
* Compares the provided instances and returns <code>true</code> if <code>left</code> is later than or equal to <code>right</code>, <code>false</code> otherwise.
*
* @param {JulianDate} left The first instance.
* @param {JulianDate} right The second instance.
* @returns {boolean} <code>true</code> if <code>left</code> is later than or equal to <code>right</code>, <code>false</code> otherwise.
*/
JulianDate.greaterThanOrEquals = function (left, right) {
return JulianDate.compare(left, right) >= 0;
};
/**
* Duplicates this instance.
*
* @param {JulianDate} [result] An existing instance to use for the result.
* @returns {JulianDate} The modified result parameter or a new instance if none was provided.
*/
JulianDate.prototype.clone = function (result) {
return JulianDate.clone(this, result);
};
/**
* Compares this and the provided instance and returns <code>true</code> if they are equal, <code>false</code> otherwise.
*
* @param {JulianDate} [right] The second instance.
* @returns {boolean} <code>true</code> if the dates are equal; otherwise, <code>false</code>.
*/
JulianDate.prototype.equals = function (right) {
return JulianDate.equals(this, right);
};
/**
* Compares this and the provided instance and returns <code>true</code> if they are within <code>epsilon</code> seconds of
* each other. That is, in order for the dates to be considered equal (and for
* this function to return <code>true</code>), the absolute value of the difference between them, in
* seconds, must be less than <code>epsilon</code>.
*
* @param {JulianDate} [right] The second instance.
* @param {number} [epsilon=0] The maximum number of seconds that should separate the two instances.
* @returns {boolean} <code>true</code> if the two dates are within <code>epsilon</code> seconds of each other; otherwise <code>false</code>.
*/
JulianDate.prototype.equalsEpsilon = function (right, epsilon) {
return JulianDate.equalsEpsilon(this, right, epsilon);
};
/**
* Creates a string representing this date in ISO8601 format.
*
* @returns {string} A string representing this date in ISO8601 format.
*/
JulianDate.prototype.toString = function () {
return JulianDate.toIso8601(this);
};
/**
* Gets or sets the list of leap seconds used throughout Cesium.
* @memberof JulianDate
* @type {LeapSecond[]}
*/
JulianDate.leapSeconds = [
new LeapSecond(new JulianDate(2441317, 43210.0, TimeStandard.TAI), 10), // January 1, 1972 00:00:00 UTC
new LeapSecond(new JulianDate(2441499, 43211.0, TimeStandard.TAI), 11), // July 1, 1972 00:00:00 UTC
new LeapSecond(new JulianDate(2441683, 43212.0, TimeStandard.TAI), 12), // January 1, 1973 00:00:00 UTC
new LeapSecond(new JulianDate(2442048, 43213.0, TimeStandard.TAI), 13), // January 1, 1974 00:00:00 UTC
new LeapSecond(new JulianDate(2442413, 43214.0, TimeStandard.TAI), 14), // January 1, 1975 00:00:00 UTC
new LeapSecond(new JulianDate(2442778, 43215.0, TimeStandard.TAI), 15), // January 1, 1976 00:00:00 UTC
new LeapSecond(new JulianDate(2443144, 43216.0, TimeStandard.TAI), 16), // January 1, 1977 00:00:00 UTC
new LeapSecond(new JulianDate(2443509, 43217.0, TimeStandard.TAI), 17), // January 1, 1978 00:00:00 UTC
new LeapSecond(new JulianDate(2443874, 43218.0, TimeStandard.TAI), 18), // January 1, 1979 00:00:00 UTC
new LeapSecond(new JulianDate(2444239, 43219.0, TimeStandard.TAI), 19), // January 1, 1980 00:00:00 UTC
new LeapSecond(new JulianDate(2444786, 43220.0, TimeStandard.TAI), 20), // July 1, 1981 00:00:00 UTC
new LeapSecond(new JulianDate(2445151, 43221.0, TimeStandard.TAI), 21), // July 1, 1982 00:00:00 UTC
new LeapSecond(new JulianDate(2445516, 43222.0, TimeStandard.TAI), 22), // July 1, 1983 00:00:00 UTC
new LeapSecond(new JulianDate(2446247, 43223.0, TimeStandard.TAI), 23), // July 1, 1985 00:00:00 UTC
new LeapSecond(new JulianDate(2447161, 43224.0, TimeStandard.TAI), 24), // January 1, 1988 00:00:00 UTC
new LeapSecond(new JulianDate(2447892, 43225.0, TimeStandard.TAI), 25), // January 1, 1990 00:00:00 UTC
new LeapSecond(new JulianDate(2448257, 43226.0, TimeStandard.TAI), 26), // January 1, 1991 00:00:00 UTC
new LeapSecond(new JulianDate(2448804, 43227.0, TimeStandard.TAI), 27), // July 1, 1992 00:00:00 UTC
new LeapSecond(new JulianDate(2449169, 43228.0, TimeStandard.TAI), 28), // July 1, 1993 00:00:00 UTC
new LeapSecond(new JulianDate(2449534, 43229.0, TimeStandard.TAI), 29), // July 1, 1994 00:00:00 UTC
new LeapSecond(new JulianDate(2450083, 43230.0, TimeStandard.TAI), 30), // January 1, 1996 00:00:00 UTC
new LeapSecond(new JulianDate(2450630, 43231.0, TimeStandard.TAI), 31), // July 1, 1997 00:00:00 UTC
new LeapSecond(new JulianDate(2451179, 43232.0, TimeStandard.TAI), 32), // January 1, 1999 00:00:00 UTC
new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC
new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC
new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35), // July 1, 2012 00:00:00 UTC
new LeapSecond(new JulianDate(2457204, 43236.0, TimeStandard.TAI), 36), // July 1, 2015 00:00:00 UTC
new LeapSecond(new JulianDate(2457754, 43237.0, TimeStandard.TAI), 37), // January 1, 2017 00:00:00 UTC
];
export default JulianDate;
|