@sme.up/ketchup 9.0.0 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{f-button-b2cfce1c.js → f-button-9ccadd52.js} +2 -2
- package/dist/cjs/{f-cell-75fca92b.js → f-cell-3130506f.js} +183 -11
- package/dist/cjs/{f-checkbox-48d7af02.js → f-checkbox-9d2635d9.js} +1 -1
- package/dist/cjs/{f-chip-3e504f3e.js → f-chip-beb7af58.js} +3 -3
- package/dist/cjs/{f-image-270d39ae.js → f-image-66a3c3c1.js} +2 -2
- package/dist/cjs/{f-paginator-utils-6d0c4678.js → f-paginator-utils-c475e07f.js} +49 -50
- package/dist/cjs/{f-text-field-bbcd2143.js → f-text-field-c74856ff.js} +38 -4
- package/dist/cjs/{index-c3d10561.js → index-d8e5eb5f.js} +156 -39
- package/dist/cjs/index.cjs.js +11 -0
- package/dist/cjs/ketchup.cjs.js +3 -3
- package/dist/cjs/kup-accordion.cjs.entry.js +3 -3
- package/dist/cjs/kup-autocomplete_27.cjs.entry.js +159 -197
- package/dist/cjs/kup-box.cjs.entry.js +23 -15
- package/dist/cjs/kup-calendar.cjs.entry.js +5061 -5028
- package/dist/cjs/kup-card-list.cjs.entry.js +34 -14
- package/dist/cjs/kup-cell.cjs.entry.js +9 -7
- package/dist/cjs/kup-dashboard.cjs.entry.js +6 -6
- package/dist/cjs/kup-drawer.cjs.entry.js +2 -2
- package/dist/cjs/kup-echart.cjs.entry.js +2 -2
- package/dist/cjs/kup-family-tree.cjs.entry.js +4 -4
- package/dist/cjs/kup-grid.cjs.entry.js +2 -2
- package/dist/cjs/kup-iframe.cjs.entry.js +2 -2
- package/dist/cjs/kup-image-list.cjs.entry.js +8 -8
- package/dist/cjs/kup-lazy.cjs.entry.js +2 -2
- package/dist/cjs/kup-magic-box.cjs.entry.js +3 -3
- package/dist/cjs/{kup-manager-130bbd9d.js → kup-manager-7334c396.js} +63 -12
- package/dist/cjs/kup-nav-bar.cjs.entry.js +2 -2
- package/dist/cjs/kup-numeric-picker.cjs.entry.js +3 -3
- package/dist/cjs/kup-photo-frame.cjs.entry.js +2 -2
- package/dist/cjs/kup-planner.cjs.entry.js +895 -410
- package/dist/cjs/kup-probe.cjs.entry.js +2 -2
- package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
- package/dist/cjs/kup-snackbar.cjs.entry.js +4 -4
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/assets/card-list.js +12 -9
- package/dist/collection/assets/index.js +4 -0
- package/dist/collection/assets/progress-bar.js +0 -0
- package/dist/collection/assets/radio.js +30 -0
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/kup-box/kup-box.js +14 -6
- package/dist/collection/components/kup-card/kup-card.css +14 -0
- package/dist/collection/components/kup-card/standard/kup-card-standard.js +10 -5
- package/dist/collection/components/kup-card-list/kup-card-list-declarations.js +10 -0
- package/dist/collection/components/kup-card-list/kup-card-list.js +232 -12
- package/dist/collection/components/kup-data-table/kup-data-table-helper.js +47 -48
- package/dist/collection/components/kup-data-table/kup-data-table.js +36 -22
- package/dist/collection/components/kup-progress-bar/kup-progress-bar.css +1 -242
- package/dist/collection/components/kup-progress-bar/kup-progress-bar.js +37 -84
- package/dist/collection/components/kup-radio/kup-radio.css +0 -161
- package/dist/collection/components/kup-radio/kup-radio.js +31 -26
- package/dist/collection/components/kup-rating/kup-rating.css +0 -8
- package/dist/collection/components/kup-rating/kup-rating.js +27 -52
- package/dist/collection/f-components/f-cell/f-cell-declarations.js +1 -0
- package/dist/collection/f-components/f-cell/f-cell.js +19 -5
- package/dist/collection/f-components/f-progress-bar/f-progress-bar-declarations.js +1 -0
- package/dist/collection/f-components/f-progress-bar/f-progress-bar.js +88 -0
- package/dist/collection/f-components/f-radio/f-radio-declarations.js +1 -0
- package/dist/collection/f-components/f-radio/f-radio.js +28 -0
- package/dist/collection/f-components/f-rating/f-rating-declarations.js +1 -0
- package/dist/collection/f-components/f-rating/f-rating.js +26 -0
- package/dist/collection/f-components/f-text-field/f-text-field.js +36 -2
- package/dist/collection/index.js +5 -0
- package/dist/collection/managers/kup-data/kup-data.js +2 -0
- package/dist/collection/managers/kup-math/kup-math-helper.js +1 -1
- package/dist/collection/managers/kup-theme/kup-theme-declarations.js +33 -0
- package/dist/collection/managers/kup-theme/kup-theme.js +13 -1
- package/dist/collection/utils/cell-utils.js +6 -7
- package/dist/collection/utils/utils.js +0 -5
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +9 -1
- package/dist/components/kup-accordion.js +4 -1
- package/dist/components/kup-autocomplete.js +1 -1
- package/dist/components/kup-autocomplete2.js +13902 -32341
- package/dist/components/kup-badge.js +1 -1
- package/dist/components/kup-box2.js +26 -7
- package/dist/components/kup-button-list.js +1 -1
- package/dist/components/kup-button.js +1 -1
- package/dist/components/kup-calendar.js +5001 -4964
- package/dist/components/kup-card-list.js +44 -13
- package/dist/components/kup-card.js +1 -1
- package/dist/components/kup-cell.js +2 -1
- package/dist/components/kup-chart.js +1 -1
- package/dist/components/kup-checkbox.js +1 -1
- package/dist/components/kup-chip.js +1 -1
- package/dist/components/kup-color-picker.js +1 -1
- package/dist/components/kup-combobox.js +1 -1
- package/dist/components/kup-dashboard.js +4 -1
- package/dist/components/kup-data-table.js +1 -1
- package/dist/components/kup-date-picker.js +1 -1
- package/dist/components/kup-dialog.js +1 -1
- package/dist/components/kup-drawer.js +2 -1
- package/dist/components/kup-dropdown-button.js +1 -1
- package/dist/components/kup-echart2.js +2 -1
- package/dist/components/kup-family-tree.js +2 -1
- package/dist/components/kup-form.js +1 -1
- package/dist/components/kup-gauge.js +1 -1
- package/dist/components/kup-grid2.js +2 -1
- package/dist/components/kup-iframe.js +2 -1
- package/dist/components/kup-image-list.js +4 -1
- package/dist/components/kup-image.js +1 -1
- package/dist/components/kup-lazy.js +2 -1
- package/dist/components/kup-list.js +1 -1
- package/dist/components/kup-magic-box.js +2 -1
- package/dist/{esm/kup-manager-c8d5c94d.js → components/kup-manager.js} +63 -13
- package/dist/components/kup-nav-bar.js +2 -1
- package/dist/components/kup-numeric-picker.js +2 -1
- package/dist/components/kup-photo-frame.js +2 -1
- package/dist/components/kup-planner.js +896 -408
- package/dist/components/kup-probe.js +2 -1
- package/dist/components/kup-progress-bar.js +1 -1
- package/dist/components/kup-qlik.js +2 -1
- package/dist/components/kup-radio.js +1 -1
- package/dist/components/kup-rating.js +1 -1
- package/dist/components/kup-snackbar.js +2 -1
- package/dist/components/kup-spinner.js +1 -1
- package/dist/components/kup-switch.js +1 -1
- package/dist/components/kup-tab-bar.js +1 -1
- package/dist/components/kup-text-field.js +1 -1
- package/dist/components/kup-time-picker.js +1 -1
- package/dist/components/kup-tree.js +1 -1
- package/dist/esm/{f-button-baa419dc.js → f-button-0bce6587.js} +2 -2
- package/dist/esm/{f-cell-18ee3afa.js → f-cell-88d375e1.js} +181 -12
- package/dist/esm/{f-checkbox-00a1e020.js → f-checkbox-31219c42.js} +1 -1
- package/dist/esm/{f-chip-311500f4.js → f-chip-ef0d4130.js} +3 -3
- package/dist/esm/{f-image-da03494c.js → f-image-727453df.js} +2 -2
- package/dist/esm/{f-paginator-utils-d63a195e.js → f-paginator-utils-4524e41c.js} +49 -50
- package/dist/esm/{f-text-field-e5f1f1fd.js → f-text-field-7b4d622c.js} +38 -4
- package/dist/esm/{index-3336c3b1.js → index-99c17b08.js} +157 -40
- package/dist/esm/index.js +8 -0
- package/dist/esm/ketchup.js +4 -4
- package/dist/esm/kup-accordion.entry.js +3 -3
- package/dist/esm/kup-autocomplete_27.entry.js +159 -197
- package/dist/esm/kup-box.entry.js +23 -15
- package/dist/esm/kup-calendar.entry.js +5061 -5028
- package/dist/esm/kup-card-list.entry.js +34 -14
- package/dist/esm/kup-cell.entry.js +9 -7
- package/dist/esm/kup-dashboard.entry.js +6 -6
- package/dist/esm/kup-drawer.entry.js +2 -2
- package/dist/esm/kup-echart.entry.js +2 -2
- package/dist/esm/kup-family-tree.entry.js +4 -4
- package/dist/esm/kup-grid.entry.js +2 -2
- package/dist/esm/kup-iframe.entry.js +2 -2
- package/dist/esm/kup-image-list.entry.js +8 -8
- package/dist/esm/kup-lazy.entry.js +2 -2
- package/dist/esm/kup-magic-box.entry.js +3 -3
- package/dist/esm/kup-manager-9a9d2dbb.js +18604 -0
- package/dist/esm/kup-nav-bar.entry.js +2 -2
- package/dist/esm/kup-numeric-picker.entry.js +3 -3
- package/dist/esm/kup-photo-frame.entry.js +2 -2
- package/dist/esm/kup-planner.entry.js +895 -410
- package/dist/esm/kup-probe.entry.js +2 -2
- package/dist/esm/kup-qlik.entry.js +2 -2
- package/dist/esm/kup-snackbar.entry.js +4 -4
- package/dist/esm/loader.js +3 -3
- package/dist/ketchup/index.esm.js +1 -0
- package/dist/ketchup/ketchup.esm.js +1 -1
- package/dist/ketchup/{p-a8a39b08.entry.js → p-042e1ed0.entry.js} +1 -1
- package/dist/ketchup/{p-55fd3f46.entry.js → p-0dc763af.entry.js} +1 -1
- package/dist/ketchup/{p-76130e83.entry.js → p-1ae879af.entry.js} +1 -1
- package/dist/ketchup/p-1db0c862.entry.js +1 -0
- package/dist/ketchup/{p-25de68e5.js → p-20458088.js} +3 -3
- package/dist/ketchup/{p-a0f59b05.entry.js → p-20c1a69f.entry.js} +1 -1
- package/dist/ketchup/p-267dd24a.entry.js +9 -0
- package/dist/ketchup/{p-39602629.js → p-2849af6f.js} +1 -1
- package/dist/ketchup/p-30938d5a.entry.js +1 -0
- package/dist/ketchup/{p-f729449f.js → p-34e4a985.js} +1 -1
- package/dist/ketchup/p-4067c71b.js +2 -0
- package/dist/ketchup/{p-8281c9e5.js → p-4e696daf.js} +1 -1
- package/dist/ketchup/p-61f71872.entry.js +1 -0
- package/dist/ketchup/p-6a7df3d2.js +1 -0
- package/dist/ketchup/{p-2dab9c4f.entry.js → p-6b33f5de.entry.js} +1 -1
- package/dist/ketchup/{p-4597f25d.js → p-7a876328.js} +1 -1
- package/dist/ketchup/{p-7e1c8fc0.entry.js → p-7f64b612.entry.js} +1 -1
- package/dist/ketchup/{p-07707cd1.entry.js → p-90db42e6.entry.js} +1 -1
- package/dist/ketchup/{p-13eac183.entry.js → p-9cc1c76b.entry.js} +1 -1
- package/dist/ketchup/p-9d3d8690.js +1 -0
- package/dist/ketchup/{p-7bf649f0.entry.js → p-b4ba27da.entry.js} +1 -1
- package/dist/ketchup/{p-2a2a18bf.entry.js → p-c046fd1c.entry.js} +1 -1
- package/dist/ketchup/p-c120043a.entry.js +1 -0
- package/dist/ketchup/p-d520d757.entry.js +1 -0
- package/dist/ketchup/p-e9bc0749.entry.js +1 -0
- package/dist/ketchup/{p-7555c10d.js → p-ea56edbe.js} +1 -1
- package/dist/ketchup/p-edd88921.entry.js +1 -0
- package/dist/ketchup/{p-da58f8ab.entry.js → p-f1f82eef.entry.js} +1 -1
- package/dist/ketchup/{p-51aa248f.entry.js → p-f67ee60f.entry.js} +3 -3
- package/dist/ketchup/p-f6844304.entry.js +1 -0
- package/dist/ketchup/{p-2d192def.entry.js → p-f8213d22.entry.js} +1 -1
- package/dist/types/components/kup-box/kup-box.d.ts +1 -0
- package/dist/types/components/kup-card-list/kup-card-list-declarations.d.ts +12 -12
- package/dist/types/components/kup-card-list/kup-card-list.d.ts +50 -0
- package/dist/types/components/kup-progress-bar/kup-progress-bar.d.ts +0 -1
- package/dist/types/components/kup-radio/kup-radio-declarations.d.ts +1 -9
- package/dist/types/components/kup-radio/kup-radio.d.ts +3 -2
- package/dist/types/components/kup-rating/kup-rating.d.ts +2 -7
- package/dist/types/components.d.ts +674 -4
- package/dist/types/f-components/f-cell/f-cell-declarations.d.ts +1 -0
- package/dist/types/f-components/f-progress-bar/f-progress-bar-declarations.d.ts +16 -0
- package/dist/types/f-components/f-progress-bar/f-progress-bar.d.ts +3 -0
- package/dist/types/f-components/f-radio/f-radio-declarations.d.ts +22 -0
- package/dist/types/f-components/f-radio/f-radio.d.ts +3 -0
- package/dist/types/f-components/f-rating/f-rating-declarations.d.ts +10 -0
- package/dist/types/f-components/f-rating/f-rating.d.ts +3 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/managers/kup-theme/kup-theme-declarations.d.ts +12 -0
- package/dist/types/stencil-public-runtime.d.ts +26 -3
- package/dist/types/utils/utils.d.ts +0 -2
- package/package.json +3 -3
- package/dist/ketchup/p-008ad26c.js +0 -1
- package/dist/ketchup/p-0c19d485.entry.js +0 -9
- package/dist/ketchup/p-2d42477d.js +0 -2
- package/dist/ketchup/p-5c15661d.entry.js +0 -1
- package/dist/ketchup/p-5cfaa673.entry.js +0 -1
- package/dist/ketchup/p-5f583257.entry.js +0 -1
- package/dist/ketchup/p-80699a95.js +0 -1
- package/dist/ketchup/p-81debebe.entry.js +0 -1
- package/dist/ketchup/p-bb854cf5.entry.js +0 -1
- package/dist/ketchup/p-d6a7498b.entry.js +0 -1
- package/dist/ketchup/p-d8384990.entry.js +0 -1
- package/dist/ketchup/p-ecb9fe91.entry.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host,
|
|
2
|
-
import {
|
|
1
|
+
import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, d as getElement, g as getAssetPath } from './index-99c17b08.js';
|
|
2
|
+
import { ap as createCommonjsModule, aq as commonjsGlobal, k as kupManagerInstance, i as KupDatesFormats, ag as getCellValueForDisplay, g as getProps, s as setProps, a as KupThemeIconValues, J as KupLanguageSearch } from './kup-manager-9a9d2dbb.js';
|
|
3
3
|
import { c as componentWrapperId } from './GenericVariables-d8d0541e.js';
|
|
4
|
-
import { F as FTextField } from './f-text-field-
|
|
4
|
+
import { F as FTextField } from './f-text-field-7b4d622c.js';
|
|
5
5
|
import { F as FTextFieldMDC } from './f-text-field-mdc-1143cf21.js';
|
|
6
6
|
import './component-879e99bf.js';
|
|
7
7
|
|
|
@@ -1416,6 +1416,17 @@ function systemLocale() {
|
|
|
1416
1416
|
return sysLocaleCache;
|
|
1417
1417
|
}
|
|
1418
1418
|
}
|
|
1419
|
+
var weekInfoCache = {};
|
|
1420
|
+
function getCachedWeekInfo(locString) {
|
|
1421
|
+
var data = weekInfoCache[locString];
|
|
1422
|
+
if (!data) {
|
|
1423
|
+
var locale = new Intl.Locale(locString);
|
|
1424
|
+
// browsers currently implement this as a property, but spec says it should be a getter function
|
|
1425
|
+
data = "getWeekInfo" in locale ? locale.getWeekInfo() : locale.weekInfo;
|
|
1426
|
+
weekInfoCache[locString] = data;
|
|
1427
|
+
}
|
|
1428
|
+
return data;
|
|
1429
|
+
}
|
|
1419
1430
|
function parseLocaleString(localeStr) {
|
|
1420
1431
|
// I really want to avoid writing a BCP 47 parser
|
|
1421
1432
|
// see, e.g. https://github.com/wooorm/bcp-47
|
|
@@ -1471,7 +1482,7 @@ function intlConfigString(localeStr, numberingSystem, outputCalendar) {
|
|
|
1471
1482
|
function mapMonths(f) {
|
|
1472
1483
|
var ms = [];
|
|
1473
1484
|
for (var i = 1; i <= 12; i++) {
|
|
1474
|
-
var dt = DateTime.utc(
|
|
1485
|
+
var dt = DateTime.utc(2009, i, 1);
|
|
1475
1486
|
ms.push(f(dt));
|
|
1476
1487
|
}
|
|
1477
1488
|
return ms;
|
|
@@ -1484,8 +1495,8 @@ function mapWeekdays(f) {
|
|
|
1484
1495
|
}
|
|
1485
1496
|
return ms;
|
|
1486
1497
|
}
|
|
1487
|
-
function listStuff(loc, length,
|
|
1488
|
-
var mode = loc.listingMode(
|
|
1498
|
+
function listStuff(loc, length, englishFn, intlFn) {
|
|
1499
|
+
var mode = loc.listingMode();
|
|
1489
1500
|
if (mode === "error") {
|
|
1490
1501
|
return null;
|
|
1491
1502
|
} else if (mode === "en") {
|
|
@@ -1647,14 +1658,20 @@ var PolyRelFormatter = /*#__PURE__*/function () {
|
|
|
1647
1658
|
};
|
|
1648
1659
|
return PolyRelFormatter;
|
|
1649
1660
|
}();
|
|
1661
|
+
var fallbackWeekSettings = {
|
|
1662
|
+
firstDay: 1,
|
|
1663
|
+
minimalDays: 4,
|
|
1664
|
+
weekend: [6, 7]
|
|
1665
|
+
};
|
|
1666
|
+
|
|
1650
1667
|
/**
|
|
1651
1668
|
* @private
|
|
1652
1669
|
*/
|
|
1653
1670
|
var Locale = /*#__PURE__*/function () {
|
|
1654
1671
|
Locale.fromOpts = function fromOpts(opts) {
|
|
1655
|
-
return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN);
|
|
1672
|
+
return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.weekSettings, opts.defaultToEN);
|
|
1656
1673
|
};
|
|
1657
|
-
Locale.create = function create(locale, numberingSystem, outputCalendar, defaultToEN) {
|
|
1674
|
+
Locale.create = function create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN) {
|
|
1658
1675
|
if (defaultToEN === void 0) {
|
|
1659
1676
|
defaultToEN = false;
|
|
1660
1677
|
}
|
|
@@ -1663,7 +1680,8 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1663
1680
|
var localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale());
|
|
1664
1681
|
var numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;
|
|
1665
1682
|
var outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
|
|
1666
|
-
|
|
1683
|
+
var weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings;
|
|
1684
|
+
return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale);
|
|
1667
1685
|
};
|
|
1668
1686
|
Locale.resetCache = function resetCache() {
|
|
1669
1687
|
sysLocaleCache = null;
|
|
@@ -1675,10 +1693,11 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1675
1693
|
var _ref2 = _temp === void 0 ? {} : _temp,
|
|
1676
1694
|
locale = _ref2.locale,
|
|
1677
1695
|
numberingSystem = _ref2.numberingSystem,
|
|
1678
|
-
outputCalendar = _ref2.outputCalendar
|
|
1679
|
-
|
|
1696
|
+
outputCalendar = _ref2.outputCalendar,
|
|
1697
|
+
weekSettings = _ref2.weekSettings;
|
|
1698
|
+
return Locale.create(locale, numberingSystem, outputCalendar, weekSettings);
|
|
1680
1699
|
};
|
|
1681
|
-
function Locale(locale, numbering, outputCalendar, specifiedLocale) {
|
|
1700
|
+
function Locale(locale, numbering, outputCalendar, weekSettings, specifiedLocale) {
|
|
1682
1701
|
var _parseLocaleString = parseLocaleString(locale),
|
|
1683
1702
|
parsedLocale = _parseLocaleString[0],
|
|
1684
1703
|
parsedNumberingSystem = _parseLocaleString[1],
|
|
@@ -1686,6 +1705,7 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1686
1705
|
this.locale = parsedLocale;
|
|
1687
1706
|
this.numberingSystem = numbering || parsedNumberingSystem || null;
|
|
1688
1707
|
this.outputCalendar = outputCalendar || parsedOutputCalendar || null;
|
|
1708
|
+
this.weekSettings = weekSettings;
|
|
1689
1709
|
this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);
|
|
1690
1710
|
this.weekdaysCache = {
|
|
1691
1711
|
format: {},
|
|
@@ -1710,7 +1730,7 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1710
1730
|
if (!alts || Object.getOwnPropertyNames(alts).length === 0) {
|
|
1711
1731
|
return this;
|
|
1712
1732
|
} else {
|
|
1713
|
-
return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, alts.defaultToEN || false);
|
|
1733
|
+
return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, validateWeekSettings(alts.weekSettings) || this.weekSettings, alts.defaultToEN || false);
|
|
1714
1734
|
}
|
|
1715
1735
|
};
|
|
1716
1736
|
_proto4.redefaultToEN = function redefaultToEN(alts) {
|
|
@@ -1729,15 +1749,12 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1729
1749
|
defaultToEN: false
|
|
1730
1750
|
}));
|
|
1731
1751
|
};
|
|
1732
|
-
_proto4.months = function months$1(length, format
|
|
1752
|
+
_proto4.months = function months$1(length, format) {
|
|
1733
1753
|
var _this2 = this;
|
|
1734
1754
|
if (format === void 0) {
|
|
1735
1755
|
format = false;
|
|
1736
1756
|
}
|
|
1737
|
-
|
|
1738
|
-
defaultOK = true;
|
|
1739
|
-
}
|
|
1740
|
-
return listStuff(this, length, defaultOK, months, function () {
|
|
1757
|
+
return listStuff(this, length, months, function () {
|
|
1741
1758
|
var intl = format ? {
|
|
1742
1759
|
month: length,
|
|
1743
1760
|
day: "numeric"
|
|
@@ -1753,15 +1770,12 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1753
1770
|
return _this2.monthsCache[formatStr][length];
|
|
1754
1771
|
});
|
|
1755
1772
|
};
|
|
1756
|
-
_proto4.weekdays = function weekdays$1(length, format
|
|
1773
|
+
_proto4.weekdays = function weekdays$1(length, format) {
|
|
1757
1774
|
var _this3 = this;
|
|
1758
1775
|
if (format === void 0) {
|
|
1759
1776
|
format = false;
|
|
1760
1777
|
}
|
|
1761
|
-
|
|
1762
|
-
defaultOK = true;
|
|
1763
|
-
}
|
|
1764
|
-
return listStuff(this, length, defaultOK, weekdays, function () {
|
|
1778
|
+
return listStuff(this, length, weekdays, function () {
|
|
1765
1779
|
var intl = format ? {
|
|
1766
1780
|
weekday: length,
|
|
1767
1781
|
year: "numeric",
|
|
@@ -1779,12 +1793,9 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1779
1793
|
return _this3.weekdaysCache[formatStr][length];
|
|
1780
1794
|
});
|
|
1781
1795
|
};
|
|
1782
|
-
_proto4.meridiems = function meridiems$1(
|
|
1796
|
+
_proto4.meridiems = function meridiems$1() {
|
|
1783
1797
|
var _this4 = this;
|
|
1784
|
-
|
|
1785
|
-
defaultOK = true;
|
|
1786
|
-
}
|
|
1787
|
-
return listStuff(this, undefined, defaultOK, function () {
|
|
1798
|
+
return listStuff(this, undefined, function () {
|
|
1788
1799
|
return meridiems;
|
|
1789
1800
|
}, function () {
|
|
1790
1801
|
// In theory there could be aribitrary day periods. We're gonna assume there are exactly two
|
|
@@ -1801,12 +1812,9 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1801
1812
|
return _this4.meridiemCache;
|
|
1802
1813
|
});
|
|
1803
1814
|
};
|
|
1804
|
-
_proto4.eras = function eras$1(length
|
|
1815
|
+
_proto4.eras = function eras$1(length) {
|
|
1805
1816
|
var _this5 = this;
|
|
1806
|
-
|
|
1807
|
-
defaultOK = true;
|
|
1808
|
-
}
|
|
1809
|
-
return listStuff(this, length, defaultOK, eras, function () {
|
|
1817
|
+
return listStuff(this, length, eras, function () {
|
|
1810
1818
|
var intl = {
|
|
1811
1819
|
era: length
|
|
1812
1820
|
};
|
|
@@ -1858,6 +1866,24 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1858
1866
|
_proto4.isEnglish = function isEnglish() {
|
|
1859
1867
|
return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us");
|
|
1860
1868
|
};
|
|
1869
|
+
_proto4.getWeekSettings = function getWeekSettings() {
|
|
1870
|
+
if (this.weekSettings) {
|
|
1871
|
+
return this.weekSettings;
|
|
1872
|
+
} else if (!hasLocaleWeekInfo()) {
|
|
1873
|
+
return fallbackWeekSettings;
|
|
1874
|
+
} else {
|
|
1875
|
+
return getCachedWeekInfo(this.locale);
|
|
1876
|
+
}
|
|
1877
|
+
};
|
|
1878
|
+
_proto4.getStartOfWeek = function getStartOfWeek() {
|
|
1879
|
+
return this.getWeekSettings().firstDay;
|
|
1880
|
+
};
|
|
1881
|
+
_proto4.getMinDaysInFirstWeek = function getMinDaysInFirstWeek() {
|
|
1882
|
+
return this.getWeekSettings().minimalDays;
|
|
1883
|
+
};
|
|
1884
|
+
_proto4.getWeekendDays = function getWeekendDays() {
|
|
1885
|
+
return this.getWeekSettings().weekend;
|
|
1886
|
+
};
|
|
1861
1887
|
_proto4.equals = function equals(other) {
|
|
1862
1888
|
return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar;
|
|
1863
1889
|
};
|
|
@@ -2065,7 +2091,7 @@ function normalizeZone(input, defaultZone) {
|
|
|
2065
2091
|
if (lowered === "default") return defaultZone;else if (lowered === "local" || lowered === "system") return SystemZone.instance;else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance;else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input);
|
|
2066
2092
|
} else if (isNumber(input)) {
|
|
2067
2093
|
return FixedOffsetZone.instance(input);
|
|
2068
|
-
} else if (typeof input === "object" &&
|
|
2094
|
+
} else if (typeof input === "object" && "offset" in input && typeof input.offset === "function") {
|
|
2069
2095
|
// This is dumb, but the instanceof check above doesn't seem to really work
|
|
2070
2096
|
// so we're duck checking it
|
|
2071
2097
|
return input;
|
|
@@ -2082,7 +2108,8 @@ var now = function now() {
|
|
|
2082
2108
|
defaultNumberingSystem = null,
|
|
2083
2109
|
defaultOutputCalendar = null,
|
|
2084
2110
|
twoDigitCutoffYear = 60,
|
|
2085
|
-
throwOnInvalid
|
|
2111
|
+
throwOnInvalid,
|
|
2112
|
+
defaultWeekSettings = null;
|
|
2086
2113
|
|
|
2087
2114
|
/**
|
|
2088
2115
|
* Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.
|
|
@@ -2193,6 +2220,33 @@ var Settings = /*#__PURE__*/function () {
|
|
|
2193
2220
|
defaultOutputCalendar = outputCalendar;
|
|
2194
2221
|
}
|
|
2195
2222
|
|
|
2223
|
+
/**
|
|
2224
|
+
* @typedef {Object} WeekSettings
|
|
2225
|
+
* @property {number} firstDay
|
|
2226
|
+
* @property {number} minimalDays
|
|
2227
|
+
* @property {number[]} weekend
|
|
2228
|
+
*/
|
|
2229
|
+
|
|
2230
|
+
/**
|
|
2231
|
+
* @return {WeekSettings|null}
|
|
2232
|
+
*/
|
|
2233
|
+
}, {
|
|
2234
|
+
key: "defaultWeekSettings",
|
|
2235
|
+
get: function get() {
|
|
2236
|
+
return defaultWeekSettings;
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
/**
|
|
2240
|
+
* Allows overriding the default locale week settings, i.e. the start of the week, the weekend and
|
|
2241
|
+
* how many days are required in the first week of a year.
|
|
2242
|
+
* Does not affect existing instances.
|
|
2243
|
+
*
|
|
2244
|
+
* @param {WeekSettings|null} weekSettings
|
|
2245
|
+
*/,
|
|
2246
|
+
set: function set(weekSettings) {
|
|
2247
|
+
defaultWeekSettings = validateWeekSettings(weekSettings);
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2196
2250
|
/**
|
|
2197
2251
|
* Get the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century.
|
|
2198
2252
|
* @type {number}
|
|
@@ -2206,10 +2260,10 @@ var Settings = /*#__PURE__*/function () {
|
|
|
2206
2260
|
/**
|
|
2207
2261
|
* Set the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century.
|
|
2208
2262
|
* @type {number}
|
|
2209
|
-
* @example Settings.twoDigitCutoffYear = 0 // cut-off year is 0, so all 'yy' are
|
|
2263
|
+
* @example Settings.twoDigitCutoffYear = 0 // cut-off year is 0, so all 'yy' are interpreted as current century
|
|
2210
2264
|
* @example Settings.twoDigitCutoffYear = 50 // '49' -> 1949; '50' -> 2050
|
|
2211
|
-
* @example Settings.twoDigitCutoffYear = 1950 //
|
|
2212
|
-
* @example Settings.twoDigitCutoffYear = 2050 // ALSO
|
|
2265
|
+
* @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50
|
|
2266
|
+
* @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50
|
|
2213
2267
|
*/,
|
|
2214
2268
|
set: function set(cutoffYear) {
|
|
2215
2269
|
twoDigitCutoffYear = cutoffYear % 100;
|
|
@@ -2236,6 +2290,230 @@ var Settings = /*#__PURE__*/function () {
|
|
|
2236
2290
|
return Settings;
|
|
2237
2291
|
}();
|
|
2238
2292
|
|
|
2293
|
+
var Invalid = /*#__PURE__*/function () {
|
|
2294
|
+
function Invalid(reason, explanation) {
|
|
2295
|
+
this.reason = reason;
|
|
2296
|
+
this.explanation = explanation;
|
|
2297
|
+
}
|
|
2298
|
+
var _proto = Invalid.prototype;
|
|
2299
|
+
_proto.toMessage = function toMessage() {
|
|
2300
|
+
if (this.explanation) {
|
|
2301
|
+
return this.reason + ": " + this.explanation;
|
|
2302
|
+
} else {
|
|
2303
|
+
return this.reason;
|
|
2304
|
+
}
|
|
2305
|
+
};
|
|
2306
|
+
return Invalid;
|
|
2307
|
+
}();
|
|
2308
|
+
|
|
2309
|
+
var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
|
|
2310
|
+
leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
|
|
2311
|
+
function unitOutOfRange(unit, value) {
|
|
2312
|
+
return new Invalid("unit out of range", "you specified " + value + " (of type " + typeof value + ") as a " + unit + ", which is invalid");
|
|
2313
|
+
}
|
|
2314
|
+
function dayOfWeek(year, month, day) {
|
|
2315
|
+
var d = new Date(Date.UTC(year, month - 1, day));
|
|
2316
|
+
if (year < 100 && year >= 0) {
|
|
2317
|
+
d.setUTCFullYear(d.getUTCFullYear() - 1900);
|
|
2318
|
+
}
|
|
2319
|
+
var js = d.getUTCDay();
|
|
2320
|
+
return js === 0 ? 7 : js;
|
|
2321
|
+
}
|
|
2322
|
+
function computeOrdinal(year, month, day) {
|
|
2323
|
+
return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
|
|
2324
|
+
}
|
|
2325
|
+
function uncomputeOrdinal(year, ordinal) {
|
|
2326
|
+
var table = isLeapYear(year) ? leapLadder : nonLeapLadder,
|
|
2327
|
+
month0 = table.findIndex(function (i) {
|
|
2328
|
+
return i < ordinal;
|
|
2329
|
+
}),
|
|
2330
|
+
day = ordinal - table[month0];
|
|
2331
|
+
return {
|
|
2332
|
+
month: month0 + 1,
|
|
2333
|
+
day: day
|
|
2334
|
+
};
|
|
2335
|
+
}
|
|
2336
|
+
function isoWeekdayToLocal(isoWeekday, startOfWeek) {
|
|
2337
|
+
return (isoWeekday - startOfWeek + 7) % 7 + 1;
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
/**
|
|
2341
|
+
* @private
|
|
2342
|
+
*/
|
|
2343
|
+
|
|
2344
|
+
function gregorianToWeek(gregObj, minDaysInFirstWeek, startOfWeek) {
|
|
2345
|
+
if (minDaysInFirstWeek === void 0) {
|
|
2346
|
+
minDaysInFirstWeek = 4;
|
|
2347
|
+
}
|
|
2348
|
+
if (startOfWeek === void 0) {
|
|
2349
|
+
startOfWeek = 1;
|
|
2350
|
+
}
|
|
2351
|
+
var year = gregObj.year,
|
|
2352
|
+
month = gregObj.month,
|
|
2353
|
+
day = gregObj.day,
|
|
2354
|
+
ordinal = computeOrdinal(year, month, day),
|
|
2355
|
+
weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek);
|
|
2356
|
+
var weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7),
|
|
2357
|
+
weekYear;
|
|
2358
|
+
if (weekNumber < 1) {
|
|
2359
|
+
weekYear = year - 1;
|
|
2360
|
+
weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek);
|
|
2361
|
+
} else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) {
|
|
2362
|
+
weekYear = year + 1;
|
|
2363
|
+
weekNumber = 1;
|
|
2364
|
+
} else {
|
|
2365
|
+
weekYear = year;
|
|
2366
|
+
}
|
|
2367
|
+
return _extends({
|
|
2368
|
+
weekYear: weekYear,
|
|
2369
|
+
weekNumber: weekNumber,
|
|
2370
|
+
weekday: weekday
|
|
2371
|
+
}, timeObject(gregObj));
|
|
2372
|
+
}
|
|
2373
|
+
function weekToGregorian(weekData, minDaysInFirstWeek, startOfWeek) {
|
|
2374
|
+
if (minDaysInFirstWeek === void 0) {
|
|
2375
|
+
minDaysInFirstWeek = 4;
|
|
2376
|
+
}
|
|
2377
|
+
if (startOfWeek === void 0) {
|
|
2378
|
+
startOfWeek = 1;
|
|
2379
|
+
}
|
|
2380
|
+
var weekYear = weekData.weekYear,
|
|
2381
|
+
weekNumber = weekData.weekNumber,
|
|
2382
|
+
weekday = weekData.weekday,
|
|
2383
|
+
weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek),
|
|
2384
|
+
yearInDays = daysInYear(weekYear);
|
|
2385
|
+
var ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek,
|
|
2386
|
+
year;
|
|
2387
|
+
if (ordinal < 1) {
|
|
2388
|
+
year = weekYear - 1;
|
|
2389
|
+
ordinal += daysInYear(year);
|
|
2390
|
+
} else if (ordinal > yearInDays) {
|
|
2391
|
+
year = weekYear + 1;
|
|
2392
|
+
ordinal -= daysInYear(weekYear);
|
|
2393
|
+
} else {
|
|
2394
|
+
year = weekYear;
|
|
2395
|
+
}
|
|
2396
|
+
var _uncomputeOrdinal = uncomputeOrdinal(year, ordinal),
|
|
2397
|
+
month = _uncomputeOrdinal.month,
|
|
2398
|
+
day = _uncomputeOrdinal.day;
|
|
2399
|
+
return _extends({
|
|
2400
|
+
year: year,
|
|
2401
|
+
month: month,
|
|
2402
|
+
day: day
|
|
2403
|
+
}, timeObject(weekData));
|
|
2404
|
+
}
|
|
2405
|
+
function gregorianToOrdinal(gregData) {
|
|
2406
|
+
var year = gregData.year,
|
|
2407
|
+
month = gregData.month,
|
|
2408
|
+
day = gregData.day;
|
|
2409
|
+
var ordinal = computeOrdinal(year, month, day);
|
|
2410
|
+
return _extends({
|
|
2411
|
+
year: year,
|
|
2412
|
+
ordinal: ordinal
|
|
2413
|
+
}, timeObject(gregData));
|
|
2414
|
+
}
|
|
2415
|
+
function ordinalToGregorian(ordinalData) {
|
|
2416
|
+
var year = ordinalData.year,
|
|
2417
|
+
ordinal = ordinalData.ordinal;
|
|
2418
|
+
var _uncomputeOrdinal2 = uncomputeOrdinal(year, ordinal),
|
|
2419
|
+
month = _uncomputeOrdinal2.month,
|
|
2420
|
+
day = _uncomputeOrdinal2.day;
|
|
2421
|
+
return _extends({
|
|
2422
|
+
year: year,
|
|
2423
|
+
month: month,
|
|
2424
|
+
day: day
|
|
2425
|
+
}, timeObject(ordinalData));
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
/**
|
|
2429
|
+
* Check if local week units like localWeekday are used in obj.
|
|
2430
|
+
* If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties.
|
|
2431
|
+
* Modifies obj in-place!
|
|
2432
|
+
* @param obj the object values
|
|
2433
|
+
*/
|
|
2434
|
+
function usesLocalWeekValues(obj, loc) {
|
|
2435
|
+
var hasLocaleWeekData = !isUndefined(obj.localWeekday) || !isUndefined(obj.localWeekNumber) || !isUndefined(obj.localWeekYear);
|
|
2436
|
+
if (hasLocaleWeekData) {
|
|
2437
|
+
var hasIsoWeekData = !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear);
|
|
2438
|
+
if (hasIsoWeekData) {
|
|
2439
|
+
throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");
|
|
2440
|
+
}
|
|
2441
|
+
if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday;
|
|
2442
|
+
if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber;
|
|
2443
|
+
if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear;
|
|
2444
|
+
delete obj.localWeekday;
|
|
2445
|
+
delete obj.localWeekNumber;
|
|
2446
|
+
delete obj.localWeekYear;
|
|
2447
|
+
return {
|
|
2448
|
+
minDaysInFirstWeek: loc.getMinDaysInFirstWeek(),
|
|
2449
|
+
startOfWeek: loc.getStartOfWeek()
|
|
2450
|
+
};
|
|
2451
|
+
} else {
|
|
2452
|
+
return {
|
|
2453
|
+
minDaysInFirstWeek: 4,
|
|
2454
|
+
startOfWeek: 1
|
|
2455
|
+
};
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
function hasInvalidWeekData(obj, minDaysInFirstWeek, startOfWeek) {
|
|
2459
|
+
if (minDaysInFirstWeek === void 0) {
|
|
2460
|
+
minDaysInFirstWeek = 4;
|
|
2461
|
+
}
|
|
2462
|
+
if (startOfWeek === void 0) {
|
|
2463
|
+
startOfWeek = 1;
|
|
2464
|
+
}
|
|
2465
|
+
var validYear = isInteger(obj.weekYear),
|
|
2466
|
+
validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)),
|
|
2467
|
+
validWeekday = integerBetween(obj.weekday, 1, 7);
|
|
2468
|
+
if (!validYear) {
|
|
2469
|
+
return unitOutOfRange("weekYear", obj.weekYear);
|
|
2470
|
+
} else if (!validWeek) {
|
|
2471
|
+
return unitOutOfRange("week", obj.weekNumber);
|
|
2472
|
+
} else if (!validWeekday) {
|
|
2473
|
+
return unitOutOfRange("weekday", obj.weekday);
|
|
2474
|
+
} else return false;
|
|
2475
|
+
}
|
|
2476
|
+
function hasInvalidOrdinalData(obj) {
|
|
2477
|
+
var validYear = isInteger(obj.year),
|
|
2478
|
+
validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
|
|
2479
|
+
if (!validYear) {
|
|
2480
|
+
return unitOutOfRange("year", obj.year);
|
|
2481
|
+
} else if (!validOrdinal) {
|
|
2482
|
+
return unitOutOfRange("ordinal", obj.ordinal);
|
|
2483
|
+
} else return false;
|
|
2484
|
+
}
|
|
2485
|
+
function hasInvalidGregorianData(obj) {
|
|
2486
|
+
var validYear = isInteger(obj.year),
|
|
2487
|
+
validMonth = integerBetween(obj.month, 1, 12),
|
|
2488
|
+
validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
|
|
2489
|
+
if (!validYear) {
|
|
2490
|
+
return unitOutOfRange("year", obj.year);
|
|
2491
|
+
} else if (!validMonth) {
|
|
2492
|
+
return unitOutOfRange("month", obj.month);
|
|
2493
|
+
} else if (!validDay) {
|
|
2494
|
+
return unitOutOfRange("day", obj.day);
|
|
2495
|
+
} else return false;
|
|
2496
|
+
}
|
|
2497
|
+
function hasInvalidTimeData(obj) {
|
|
2498
|
+
var hour = obj.hour,
|
|
2499
|
+
minute = obj.minute,
|
|
2500
|
+
second = obj.second,
|
|
2501
|
+
millisecond = obj.millisecond;
|
|
2502
|
+
var validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0,
|
|
2503
|
+
validMinute = integerBetween(minute, 0, 59),
|
|
2504
|
+
validSecond = integerBetween(second, 0, 59),
|
|
2505
|
+
validMillisecond = integerBetween(millisecond, 0, 999);
|
|
2506
|
+
if (!validHour) {
|
|
2507
|
+
return unitOutOfRange("hour", hour);
|
|
2508
|
+
} else if (!validMinute) {
|
|
2509
|
+
return unitOutOfRange("minute", minute);
|
|
2510
|
+
} else if (!validSecond) {
|
|
2511
|
+
return unitOutOfRange("second", second);
|
|
2512
|
+
} else if (!validMillisecond) {
|
|
2513
|
+
return unitOutOfRange("millisecond", millisecond);
|
|
2514
|
+
} else return false;
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2239
2517
|
/**
|
|
2240
2518
|
* @private
|
|
2241
2519
|
*/
|
|
@@ -2267,6 +2545,13 @@ function hasRelative() {
|
|
|
2267
2545
|
return false;
|
|
2268
2546
|
}
|
|
2269
2547
|
}
|
|
2548
|
+
function hasLocaleWeekInfo() {
|
|
2549
|
+
try {
|
|
2550
|
+
return typeof Intl !== "undefined" && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype);
|
|
2551
|
+
} catch (e) {
|
|
2552
|
+
return false;
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2270
2555
|
|
|
2271
2556
|
// OBJECTS AND ARRAYS
|
|
2272
2557
|
|
|
@@ -2297,6 +2582,24 @@ function pick(obj, keys) {
|
|
|
2297
2582
|
function hasOwnProperty(obj, prop) {
|
|
2298
2583
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
2299
2584
|
}
|
|
2585
|
+
function validateWeekSettings(settings) {
|
|
2586
|
+
if (settings == null) {
|
|
2587
|
+
return null;
|
|
2588
|
+
} else if (typeof settings !== "object") {
|
|
2589
|
+
throw new InvalidArgumentError("Week settings must be an object");
|
|
2590
|
+
} else {
|
|
2591
|
+
if (!integerBetween(settings.firstDay, 1, 7) || !integerBetween(settings.minimalDays, 1, 7) || !Array.isArray(settings.weekend) || settings.weekend.some(function (v) {
|
|
2592
|
+
return !integerBetween(v, 1, 7);
|
|
2593
|
+
})) {
|
|
2594
|
+
throw new InvalidArgumentError("Invalid week settings");
|
|
2595
|
+
}
|
|
2596
|
+
return {
|
|
2597
|
+
firstDay: settings.firstDay,
|
|
2598
|
+
minimalDays: settings.minimalDays,
|
|
2599
|
+
weekend: Array.from(settings.weekend)
|
|
2600
|
+
};
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2300
2603
|
|
|
2301
2604
|
// NUMBERS AND STRINGS
|
|
2302
2605
|
|
|
@@ -2371,7 +2674,7 @@ function daysInMonth(year, month) {
|
|
|
2371
2674
|
}
|
|
2372
2675
|
}
|
|
2373
2676
|
|
|
2374
|
-
//
|
|
2677
|
+
// convert a calendar object to a local timestamp (epoch, but with the offset baked in)
|
|
2375
2678
|
function objToLocalTS(obj) {
|
|
2376
2679
|
var d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond);
|
|
2377
2680
|
|
|
@@ -2385,11 +2688,22 @@ function objToLocalTS(obj) {
|
|
|
2385
2688
|
}
|
|
2386
2689
|
return +d;
|
|
2387
2690
|
}
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
return
|
|
2691
|
+
|
|
2692
|
+
// adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js
|
|
2693
|
+
function firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) {
|
|
2694
|
+
var fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek);
|
|
2695
|
+
return -fwdlw + minDaysInFirstWeek - 1;
|
|
2696
|
+
}
|
|
2697
|
+
function weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek) {
|
|
2698
|
+
if (minDaysInFirstWeek === void 0) {
|
|
2699
|
+
minDaysInFirstWeek = 4;
|
|
2700
|
+
}
|
|
2701
|
+
if (startOfWeek === void 0) {
|
|
2702
|
+
startOfWeek = 1;
|
|
2703
|
+
}
|
|
2704
|
+
var weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek);
|
|
2705
|
+
var weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek);
|
|
2706
|
+
return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7;
|
|
2393
2707
|
}
|
|
2394
2708
|
function untruncateYear(year) {
|
|
2395
2709
|
if (year > 99) {
|
|
@@ -2684,33 +2998,24 @@ var Formatter = /*#__PURE__*/function () {
|
|
|
2684
2998
|
var df = this.systemLoc.dtFormatter(dt, _extends({}, this.opts, opts));
|
|
2685
2999
|
return df.format();
|
|
2686
3000
|
};
|
|
2687
|
-
_proto.
|
|
3001
|
+
_proto.dtFormatter = function dtFormatter(dt, opts) {
|
|
2688
3002
|
if (opts === void 0) {
|
|
2689
3003
|
opts = {};
|
|
2690
3004
|
}
|
|
2691
|
-
|
|
2692
|
-
|
|
3005
|
+
return this.loc.dtFormatter(dt, _extends({}, this.opts, opts));
|
|
3006
|
+
};
|
|
3007
|
+
_proto.formatDateTime = function formatDateTime(dt, opts) {
|
|
3008
|
+
return this.dtFormatter(dt, opts).format();
|
|
2693
3009
|
};
|
|
2694
3010
|
_proto.formatDateTimeParts = function formatDateTimeParts(dt, opts) {
|
|
2695
|
-
|
|
2696
|
-
opts = {};
|
|
2697
|
-
}
|
|
2698
|
-
var df = this.loc.dtFormatter(dt, _extends({}, this.opts, opts));
|
|
2699
|
-
return df.formatToParts();
|
|
3011
|
+
return this.dtFormatter(dt, opts).formatToParts();
|
|
2700
3012
|
};
|
|
2701
3013
|
_proto.formatInterval = function formatInterval(interval, opts) {
|
|
2702
|
-
|
|
2703
|
-
opts = {};
|
|
2704
|
-
}
|
|
2705
|
-
var df = this.loc.dtFormatter(interval.start, _extends({}, this.opts, opts));
|
|
3014
|
+
var df = this.dtFormatter(interval.start, opts);
|
|
2706
3015
|
return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate());
|
|
2707
3016
|
};
|
|
2708
3017
|
_proto.resolvedOptions = function resolvedOptions(dt, opts) {
|
|
2709
|
-
|
|
2710
|
-
opts = {};
|
|
2711
|
-
}
|
|
2712
|
-
var df = this.loc.dtFormatter(dt, _extends({}, this.opts, opts));
|
|
2713
|
-
return df.resolvedOptions();
|
|
3018
|
+
return this.dtFormatter(dt, opts).resolvedOptions();
|
|
2714
3019
|
};
|
|
2715
3020
|
_proto.num = function num(n, p) {
|
|
2716
3021
|
if (p === void 0) {
|
|
@@ -2776,7 +3081,7 @@ var Formatter = /*#__PURE__*/function () {
|
|
|
2776
3081
|
}, "era");
|
|
2777
3082
|
},
|
|
2778
3083
|
tokenToString = function tokenToString(token) {
|
|
2779
|
-
// Where possible:
|
|
3084
|
+
// Where possible: https://cldr.unicode.org/translation/date-time/date-time-symbols
|
|
2780
3085
|
switch (token) {
|
|
2781
3086
|
// ms
|
|
2782
3087
|
case "S":
|
|
@@ -2962,6 +3267,14 @@ var Formatter = /*#__PURE__*/function () {
|
|
|
2962
3267
|
return _this.num(dt.weekNumber);
|
|
2963
3268
|
case "WW":
|
|
2964
3269
|
return _this.num(dt.weekNumber, 2);
|
|
3270
|
+
case "n":
|
|
3271
|
+
return _this.num(dt.localWeekNumber);
|
|
3272
|
+
case "nn":
|
|
3273
|
+
return _this.num(dt.localWeekNumber, 2);
|
|
3274
|
+
case "ii":
|
|
3275
|
+
return _this.num(dt.localWeekYear.toString().slice(-2), 2);
|
|
3276
|
+
case "iiii":
|
|
3277
|
+
return _this.num(dt.localWeekYear, 4);
|
|
2965
3278
|
case "o":
|
|
2966
3279
|
return _this.num(dt.ordinal);
|
|
2967
3280
|
case "ooo":
|
|
@@ -3030,22 +3343,6 @@ var Formatter = /*#__PURE__*/function () {
|
|
|
3030
3343
|
return Formatter;
|
|
3031
3344
|
}();
|
|
3032
3345
|
|
|
3033
|
-
var Invalid = /*#__PURE__*/function () {
|
|
3034
|
-
function Invalid(reason, explanation) {
|
|
3035
|
-
this.reason = reason;
|
|
3036
|
-
this.explanation = explanation;
|
|
3037
|
-
}
|
|
3038
|
-
var _proto = Invalid.prototype;
|
|
3039
|
-
_proto.toMessage = function toMessage() {
|
|
3040
|
-
if (this.explanation) {
|
|
3041
|
-
return this.reason + ": " + this.explanation;
|
|
3042
|
-
} else {
|
|
3043
|
-
return this.reason;
|
|
3044
|
-
}
|
|
3045
|
-
};
|
|
3046
|
-
return Invalid;
|
|
3047
|
-
}();
|
|
3048
|
-
|
|
3049
3346
|
/*
|
|
3050
3347
|
* This file handles parsing for well-specified formats. Here's how it works:
|
|
3051
3348
|
* Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.
|
|
@@ -3429,27 +3726,62 @@ function clone$1(dur, alts, clear) {
|
|
|
3429
3726
|
};
|
|
3430
3727
|
return new Duration(conf);
|
|
3431
3728
|
}
|
|
3432
|
-
function
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
added = !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw);
|
|
3443
|
-
toMap[toUnit] += added;
|
|
3444
|
-
fromMap[fromUnit] -= added * conv;
|
|
3729
|
+
function durationToMillis(matrix, vals) {
|
|
3730
|
+
var _vals$milliseconds;
|
|
3731
|
+
var sum = (_vals$milliseconds = vals.milliseconds) != null ? _vals$milliseconds : 0;
|
|
3732
|
+
for (var _iterator = _createForOfIteratorHelperLoose(reverseUnits.slice(1)), _step; !(_step = _iterator()).done;) {
|
|
3733
|
+
var unit = _step.value;
|
|
3734
|
+
if (vals[unit]) {
|
|
3735
|
+
sum += vals[unit] * matrix[unit]["milliseconds"];
|
|
3736
|
+
}
|
|
3737
|
+
}
|
|
3738
|
+
return sum;
|
|
3445
3739
|
}
|
|
3446
3740
|
|
|
3447
3741
|
// NB: mutates parameters
|
|
3448
3742
|
function normalizeValues(matrix, vals) {
|
|
3449
|
-
|
|
3743
|
+
// the logic below assumes the overall value of the duration is positive
|
|
3744
|
+
// if this is not the case, factor is used to make it so
|
|
3745
|
+
var factor = durationToMillis(matrix, vals) < 0 ? -1 : 1;
|
|
3746
|
+
orderedUnits$1.reduceRight(function (previous, current) {
|
|
3450
3747
|
if (!isUndefined(vals[current])) {
|
|
3451
3748
|
if (previous) {
|
|
3452
|
-
|
|
3749
|
+
var previousVal = vals[previous] * factor;
|
|
3750
|
+
var conv = matrix[current][previous];
|
|
3751
|
+
|
|
3752
|
+
// if (previousVal < 0):
|
|
3753
|
+
// lower order unit is negative (e.g. { years: 2, days: -2 })
|
|
3754
|
+
// normalize this by reducing the higher order unit by the appropriate amount
|
|
3755
|
+
// and increasing the lower order unit
|
|
3756
|
+
// this can never make the higher order unit negative, because this function only operates
|
|
3757
|
+
// on positive durations, so the amount of time represented by the lower order unit cannot
|
|
3758
|
+
// be larger than the higher order unit
|
|
3759
|
+
// else:
|
|
3760
|
+
// lower order unit is positive (e.g. { years: 2, days: 450 } or { years: -2, days: 450 })
|
|
3761
|
+
// in this case we attempt to convert as much as possible from the lower order unit into
|
|
3762
|
+
// the higher order one
|
|
3763
|
+
//
|
|
3764
|
+
// Math.floor takes care of both of these cases, rounding away from 0
|
|
3765
|
+
// if previousVal < 0 it makes the absolute value larger
|
|
3766
|
+
// if previousVal >= it makes the absolute value smaller
|
|
3767
|
+
var rollUp = Math.floor(previousVal / conv);
|
|
3768
|
+
vals[current] += rollUp * factor;
|
|
3769
|
+
vals[previous] -= rollUp * conv * factor;
|
|
3770
|
+
}
|
|
3771
|
+
return current;
|
|
3772
|
+
} else {
|
|
3773
|
+
return previous;
|
|
3774
|
+
}
|
|
3775
|
+
}, null);
|
|
3776
|
+
|
|
3777
|
+
// try to convert any decimals into smaller units if possible
|
|
3778
|
+
// for example for { years: 2.5, days: 0, seconds: 0 } we want to get { years: 2, days: 182, hours: 12 }
|
|
3779
|
+
orderedUnits$1.reduce(function (previous, current) {
|
|
3780
|
+
if (!isUndefined(vals[current])) {
|
|
3781
|
+
if (previous) {
|
|
3782
|
+
var fraction = vals[previous] % 1;
|
|
3783
|
+
vals[previous] -= fraction;
|
|
3784
|
+
vals[current] += fraction * matrix[previous][current];
|
|
3453
3785
|
}
|
|
3454
3786
|
return current;
|
|
3455
3787
|
} else {
|
|
@@ -3485,7 +3817,7 @@ function removeZeroes(vals) {
|
|
|
3485
3817
|
*
|
|
3486
3818
|
* There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation.
|
|
3487
3819
|
*/
|
|
3488
|
-
var Duration = /*#__PURE__*/function () {
|
|
3820
|
+
var Duration = /*#__PURE__*/function (_Symbol$for) {
|
|
3489
3821
|
/**
|
|
3490
3822
|
* @private
|
|
3491
3823
|
*/
|
|
@@ -3744,9 +4076,10 @@ var Duration = /*#__PURE__*/function () {
|
|
|
3744
4076
|
|
|
3745
4077
|
/**
|
|
3746
4078
|
* Returns a string representation of a Duration with all units included.
|
|
3747
|
-
* To modify its behavior use
|
|
3748
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
|
|
3749
|
-
* @param opts -
|
|
4079
|
+
* To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.
|
|
4080
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
|
|
4081
|
+
* @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.
|
|
4082
|
+
* @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor.
|
|
3750
4083
|
* @example
|
|
3751
4084
|
* ```js
|
|
3752
4085
|
* var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
|
|
@@ -3760,6 +4093,7 @@ var Duration = /*#__PURE__*/function () {
|
|
|
3760
4093
|
if (opts === void 0) {
|
|
3761
4094
|
opts = {};
|
|
3762
4095
|
}
|
|
4096
|
+
if (!this.isValid) return INVALID$2;
|
|
3763
4097
|
var l = orderedUnits$1.map(function (unit) {
|
|
3764
4098
|
var val = _this.values[unit];
|
|
3765
4099
|
if (isUndefined(val)) {
|
|
@@ -3847,20 +4181,13 @@ var Duration = /*#__PURE__*/function () {
|
|
|
3847
4181
|
suppressSeconds: false,
|
|
3848
4182
|
includePrefix: false,
|
|
3849
4183
|
format: "extended"
|
|
3850
|
-
}, opts
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
}
|
|
3858
|
-
}
|
|
3859
|
-
var str = value.toFormat(fmt);
|
|
3860
|
-
if (opts.includePrefix) {
|
|
3861
|
-
str = "T" + str;
|
|
3862
|
-
}
|
|
3863
|
-
return str;
|
|
4184
|
+
}, opts, {
|
|
4185
|
+
includeOffset: false
|
|
4186
|
+
});
|
|
4187
|
+
var dateTime = DateTime.fromMillis(millis, {
|
|
4188
|
+
zone: "UTC"
|
|
4189
|
+
});
|
|
4190
|
+
return dateTime.toISOTime(opts);
|
|
3864
4191
|
}
|
|
3865
4192
|
|
|
3866
4193
|
/**
|
|
@@ -3879,12 +4206,25 @@ var Duration = /*#__PURE__*/function () {
|
|
|
3879
4206
|
return this.toISO();
|
|
3880
4207
|
}
|
|
3881
4208
|
|
|
4209
|
+
/**
|
|
4210
|
+
* Returns a string representation of this Duration appropriate for the REPL.
|
|
4211
|
+
* @return {string}
|
|
4212
|
+
*/;
|
|
4213
|
+
_proto[_Symbol$for] = function () {
|
|
4214
|
+
if (this.isValid) {
|
|
4215
|
+
return "Duration { values: " + JSON.stringify(this.values) + " }";
|
|
4216
|
+
} else {
|
|
4217
|
+
return "Duration { Invalid, reason: " + this.invalidReason + " }";
|
|
4218
|
+
}
|
|
4219
|
+
}
|
|
4220
|
+
|
|
3882
4221
|
/**
|
|
3883
4222
|
* Returns an milliseconds value of this Duration.
|
|
3884
4223
|
* @return {number}
|
|
3885
4224
|
*/;
|
|
3886
4225
|
_proto.toMillis = function toMillis() {
|
|
3887
|
-
|
|
4226
|
+
if (!this.isValid) return NaN;
|
|
4227
|
+
return durationToMillis(this.matrix, this.values);
|
|
3888
4228
|
}
|
|
3889
4229
|
|
|
3890
4230
|
/**
|
|
@@ -4009,8 +4349,17 @@ var Duration = /*#__PURE__*/function () {
|
|
|
4009
4349
|
|
|
4010
4350
|
/**
|
|
4011
4351
|
* Reduce this Duration to its canonical representation in its current units.
|
|
4352
|
+
* Assuming the overall value of the Duration is positive, this means:
|
|
4353
|
+
* - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example)
|
|
4354
|
+
* - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise
|
|
4355
|
+
* the overall value would be negative, see third example)
|
|
4356
|
+
* - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example)
|
|
4357
|
+
*
|
|
4358
|
+
* If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`.
|
|
4012
4359
|
* @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }
|
|
4360
|
+
* @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 }
|
|
4013
4361
|
* @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }
|
|
4362
|
+
* @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 }
|
|
4014
4363
|
* @return {Duration}
|
|
4015
4364
|
*/;
|
|
4016
4365
|
_proto.normalize = function normalize() {
|
|
@@ -4071,16 +4420,13 @@ var Duration = /*#__PURE__*/function () {
|
|
|
4071
4420
|
if (isNumber(vals[k])) {
|
|
4072
4421
|
own += vals[k];
|
|
4073
4422
|
}
|
|
4423
|
+
|
|
4424
|
+
// only keep the integer part for now in the hopes of putting any decimal part
|
|
4425
|
+
// into a smaller unit later
|
|
4074
4426
|
var i = Math.trunc(own);
|
|
4075
4427
|
built[k] = i;
|
|
4076
4428
|
accumulated[k] = (own * 1000 - i * 1000) / 1000;
|
|
4077
4429
|
|
|
4078
|
-
// plus anything further down the chain that should be rolled up in to this
|
|
4079
|
-
for (var down in vals) {
|
|
4080
|
-
if (orderedUnits$1.indexOf(down) > orderedUnits$1.indexOf(k)) {
|
|
4081
|
-
convert(this.matrix, vals, down, built, k);
|
|
4082
|
-
}
|
|
4083
|
-
}
|
|
4084
4430
|
// otherwise, keep it in the wings to boil it later
|
|
4085
4431
|
} else if (isNumber(vals[k])) {
|
|
4086
4432
|
accumulated[k] = vals[k];
|
|
@@ -4094,9 +4440,10 @@ var Duration = /*#__PURE__*/function () {
|
|
|
4094
4440
|
built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];
|
|
4095
4441
|
}
|
|
4096
4442
|
}
|
|
4443
|
+
normalizeValues(this.matrix, built);
|
|
4097
4444
|
return clone$1(this, {
|
|
4098
4445
|
values: built
|
|
4099
|
-
}, true)
|
|
4446
|
+
}, true);
|
|
4100
4447
|
}
|
|
4101
4448
|
|
|
4102
4449
|
/**
|
|
@@ -4290,7 +4637,7 @@ var Duration = /*#__PURE__*/function () {
|
|
|
4290
4637
|
}
|
|
4291
4638
|
}]);
|
|
4292
4639
|
return Duration;
|
|
4293
|
-
}();
|
|
4640
|
+
}(Symbol.for("nodejs.util.inspect.custom"));
|
|
4294
4641
|
|
|
4295
4642
|
var INVALID$1 = "Invalid Interval";
|
|
4296
4643
|
|
|
@@ -4319,7 +4666,7 @@ function validateStartEnd(start, end) {
|
|
|
4319
4666
|
* * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs}
|
|
4320
4667
|
* * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toLocaleString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}.
|
|
4321
4668
|
*/
|
|
4322
|
-
var Interval = /*#__PURE__*/function () {
|
|
4669
|
+
var Interval = /*#__PURE__*/function (_Symbol$for) {
|
|
4323
4670
|
/**
|
|
4324
4671
|
* @private
|
|
4325
4672
|
*/
|
|
@@ -4485,15 +4832,25 @@ var Interval = /*#__PURE__*/function () {
|
|
|
4485
4832
|
* Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'
|
|
4486
4833
|
* asks 'what dates are included in this interval?', not 'how many days long is this interval?'
|
|
4487
4834
|
* @param {string} [unit='milliseconds'] - the unit of time to count.
|
|
4835
|
+
* @param {Object} opts - options
|
|
4836
|
+
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime
|
|
4488
4837
|
* @return {number}
|
|
4489
4838
|
*/;
|
|
4490
|
-
_proto.count = function count(unit) {
|
|
4839
|
+
_proto.count = function count(unit, opts) {
|
|
4491
4840
|
if (unit === void 0) {
|
|
4492
4841
|
unit = "milliseconds";
|
|
4493
4842
|
}
|
|
4494
4843
|
if (!this.isValid) return NaN;
|
|
4495
|
-
var start = this.start.startOf(unit)
|
|
4496
|
-
|
|
4844
|
+
var start = this.start.startOf(unit, opts);
|
|
4845
|
+
var end;
|
|
4846
|
+
if (opts != null && opts.useLocaleWeeks) {
|
|
4847
|
+
end = this.end.reconfigure({
|
|
4848
|
+
locale: start.locale
|
|
4849
|
+
});
|
|
4850
|
+
} else {
|
|
4851
|
+
end = this.end;
|
|
4852
|
+
}
|
|
4853
|
+
end = end.startOf(unit, opts);
|
|
4497
4854
|
return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());
|
|
4498
4855
|
}
|
|
4499
4856
|
|
|
@@ -4572,7 +4929,9 @@ var Interval = /*#__PURE__*/function () {
|
|
|
4572
4929
|
}
|
|
4573
4930
|
var sorted = dateTimes.map(friendlyDateTime).filter(function (d) {
|
|
4574
4931
|
return _this.contains(d);
|
|
4575
|
-
}).sort()
|
|
4932
|
+
}).sort(function (a, b) {
|
|
4933
|
+
return a.toMillis() - b.toMillis();
|
|
4934
|
+
}),
|
|
4576
4935
|
results = [];
|
|
4577
4936
|
var s = this.s,
|
|
4578
4937
|
i = 0;
|
|
@@ -4797,6 +5156,18 @@ var Interval = /*#__PURE__*/function () {
|
|
|
4797
5156
|
return "[" + this.s.toISO() + " \u2013 " + this.e.toISO() + ")";
|
|
4798
5157
|
}
|
|
4799
5158
|
|
|
5159
|
+
/**
|
|
5160
|
+
* Returns a string representation of this Interval appropriate for the REPL.
|
|
5161
|
+
* @return {string}
|
|
5162
|
+
*/;
|
|
5163
|
+
_proto[_Symbol$for] = function () {
|
|
5164
|
+
if (this.isValid) {
|
|
5165
|
+
return "Interval { start: " + this.s.toISO() + ", end: " + this.e.toISO() + " }";
|
|
5166
|
+
} else {
|
|
5167
|
+
return "Interval { Invalid, reason: " + this.invalidReason + " }";
|
|
5168
|
+
}
|
|
5169
|
+
}
|
|
5170
|
+
|
|
4800
5171
|
/**
|
|
4801
5172
|
* Returns a localized string representing this Interval. Accepts the same options as the
|
|
4802
5173
|
* Intl.DateTimeFormat constructor and any presets defined by Luxon, such as
|
|
@@ -4954,7 +5325,7 @@ var Interval = /*#__PURE__*/function () {
|
|
|
4954
5325
|
}
|
|
4955
5326
|
}]);
|
|
4956
5327
|
return Interval;
|
|
4957
|
-
}();
|
|
5328
|
+
}(Symbol.for("nodejs.util.inspect.custom"));
|
|
4958
5329
|
|
|
4959
5330
|
/**
|
|
4960
5331
|
* The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.
|
|
@@ -5005,6 +5376,56 @@ var Info = /*#__PURE__*/function () {
|
|
|
5005
5376
|
return normalizeZone(input, Settings.defaultZone);
|
|
5006
5377
|
}
|
|
5007
5378
|
|
|
5379
|
+
/**
|
|
5380
|
+
* Get the weekday on which the week starts according to the given locale.
|
|
5381
|
+
* @param {Object} opts - options
|
|
5382
|
+
* @param {string} [opts.locale] - the locale code
|
|
5383
|
+
* @param {string} [opts.locObj=null] - an existing locale object to use
|
|
5384
|
+
* @returns {number} the start of the week, 1 for Monday through 7 for Sunday
|
|
5385
|
+
*/;
|
|
5386
|
+
Info.getStartOfWeek = function getStartOfWeek(_temp) {
|
|
5387
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
5388
|
+
_ref$locale = _ref.locale,
|
|
5389
|
+
locale = _ref$locale === void 0 ? null : _ref$locale,
|
|
5390
|
+
_ref$locObj = _ref.locObj,
|
|
5391
|
+
locObj = _ref$locObj === void 0 ? null : _ref$locObj;
|
|
5392
|
+
return (locObj || Locale.create(locale)).getStartOfWeek();
|
|
5393
|
+
}
|
|
5394
|
+
|
|
5395
|
+
/**
|
|
5396
|
+
* Get the minimum number of days necessary in a week before it is considered part of the next year according
|
|
5397
|
+
* to the given locale.
|
|
5398
|
+
* @param {Object} opts - options
|
|
5399
|
+
* @param {string} [opts.locale] - the locale code
|
|
5400
|
+
* @param {string} [opts.locObj=null] - an existing locale object to use
|
|
5401
|
+
* @returns {number}
|
|
5402
|
+
*/;
|
|
5403
|
+
Info.getMinimumDaysInFirstWeek = function getMinimumDaysInFirstWeek(_temp2) {
|
|
5404
|
+
var _ref2 = _temp2 === void 0 ? {} : _temp2,
|
|
5405
|
+
_ref2$locale = _ref2.locale,
|
|
5406
|
+
locale = _ref2$locale === void 0 ? null : _ref2$locale,
|
|
5407
|
+
_ref2$locObj = _ref2.locObj,
|
|
5408
|
+
locObj = _ref2$locObj === void 0 ? null : _ref2$locObj;
|
|
5409
|
+
return (locObj || Locale.create(locale)).getMinDaysInFirstWeek();
|
|
5410
|
+
}
|
|
5411
|
+
|
|
5412
|
+
/**
|
|
5413
|
+
* Get the weekdays, which are considered the weekend according to the given locale
|
|
5414
|
+
* @param {Object} opts - options
|
|
5415
|
+
* @param {string} [opts.locale] - the locale code
|
|
5416
|
+
* @param {string} [opts.locObj=null] - an existing locale object to use
|
|
5417
|
+
* @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday
|
|
5418
|
+
*/;
|
|
5419
|
+
Info.getWeekendWeekdays = function getWeekendWeekdays(_temp3) {
|
|
5420
|
+
var _ref3 = _temp3 === void 0 ? {} : _temp3,
|
|
5421
|
+
_ref3$locale = _ref3.locale,
|
|
5422
|
+
locale = _ref3$locale === void 0 ? null : _ref3$locale,
|
|
5423
|
+
_ref3$locObj = _ref3.locObj,
|
|
5424
|
+
locObj = _ref3$locObj === void 0 ? null : _ref3$locObj;
|
|
5425
|
+
// copy the array, because we cache it internally
|
|
5426
|
+
return (locObj || Locale.create(locale)).getWeekendDays().slice();
|
|
5427
|
+
}
|
|
5428
|
+
|
|
5008
5429
|
/**
|
|
5009
5430
|
* Return an array of standalone month names.
|
|
5010
5431
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
|
|
@@ -5022,19 +5443,19 @@ var Info = /*#__PURE__*/function () {
|
|
|
5022
5443
|
* @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'
|
|
5023
5444
|
* @return {Array}
|
|
5024
5445
|
*/;
|
|
5025
|
-
Info.months = function months(length,
|
|
5446
|
+
Info.months = function months(length, _temp4) {
|
|
5026
5447
|
if (length === void 0) {
|
|
5027
5448
|
length = "long";
|
|
5028
5449
|
}
|
|
5029
|
-
var
|
|
5030
|
-
|
|
5031
|
-
locale =
|
|
5032
|
-
|
|
5033
|
-
numberingSystem =
|
|
5034
|
-
|
|
5035
|
-
locObj =
|
|
5036
|
-
|
|
5037
|
-
outputCalendar =
|
|
5450
|
+
var _ref4 = _temp4 === void 0 ? {} : _temp4,
|
|
5451
|
+
_ref4$locale = _ref4.locale,
|
|
5452
|
+
locale = _ref4$locale === void 0 ? null : _ref4$locale,
|
|
5453
|
+
_ref4$numberingSystem = _ref4.numberingSystem,
|
|
5454
|
+
numberingSystem = _ref4$numberingSystem === void 0 ? null : _ref4$numberingSystem,
|
|
5455
|
+
_ref4$locObj = _ref4.locObj,
|
|
5456
|
+
locObj = _ref4$locObj === void 0 ? null : _ref4$locObj,
|
|
5457
|
+
_ref4$outputCalendar = _ref4.outputCalendar,
|
|
5458
|
+
outputCalendar = _ref4$outputCalendar === void 0 ? "gregory" : _ref4$outputCalendar;
|
|
5038
5459
|
return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);
|
|
5039
5460
|
}
|
|
5040
5461
|
|
|
@@ -5051,19 +5472,19 @@ var Info = /*#__PURE__*/function () {
|
|
|
5051
5472
|
* @param {string} [opts.outputCalendar='gregory'] - the calendar
|
|
5052
5473
|
* @return {Array}
|
|
5053
5474
|
*/;
|
|
5054
|
-
Info.monthsFormat = function monthsFormat(length,
|
|
5475
|
+
Info.monthsFormat = function monthsFormat(length, _temp5) {
|
|
5055
5476
|
if (length === void 0) {
|
|
5056
5477
|
length = "long";
|
|
5057
5478
|
}
|
|
5058
|
-
var
|
|
5059
|
-
|
|
5060
|
-
locale =
|
|
5061
|
-
|
|
5062
|
-
numberingSystem =
|
|
5063
|
-
|
|
5064
|
-
locObj =
|
|
5065
|
-
|
|
5066
|
-
outputCalendar =
|
|
5479
|
+
var _ref5 = _temp5 === void 0 ? {} : _temp5,
|
|
5480
|
+
_ref5$locale = _ref5.locale,
|
|
5481
|
+
locale = _ref5$locale === void 0 ? null : _ref5$locale,
|
|
5482
|
+
_ref5$numberingSystem = _ref5.numberingSystem,
|
|
5483
|
+
numberingSystem = _ref5$numberingSystem === void 0 ? null : _ref5$numberingSystem,
|
|
5484
|
+
_ref5$locObj = _ref5.locObj,
|
|
5485
|
+
locObj = _ref5$locObj === void 0 ? null : _ref5$locObj,
|
|
5486
|
+
_ref5$outputCalendar = _ref5.outputCalendar,
|
|
5487
|
+
outputCalendar = _ref5$outputCalendar === void 0 ? "gregory" : _ref5$outputCalendar;
|
|
5067
5488
|
return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);
|
|
5068
5489
|
}
|
|
5069
5490
|
|
|
@@ -5081,17 +5502,17 @@ var Info = /*#__PURE__*/function () {
|
|
|
5081
5502
|
* @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'
|
|
5082
5503
|
* @return {Array}
|
|
5083
5504
|
*/;
|
|
5084
|
-
Info.weekdays = function weekdays(length,
|
|
5505
|
+
Info.weekdays = function weekdays(length, _temp6) {
|
|
5085
5506
|
if (length === void 0) {
|
|
5086
5507
|
length = "long";
|
|
5087
5508
|
}
|
|
5088
|
-
var
|
|
5089
|
-
|
|
5090
|
-
locale =
|
|
5091
|
-
|
|
5092
|
-
numberingSystem =
|
|
5093
|
-
|
|
5094
|
-
locObj =
|
|
5509
|
+
var _ref6 = _temp6 === void 0 ? {} : _temp6,
|
|
5510
|
+
_ref6$locale = _ref6.locale,
|
|
5511
|
+
locale = _ref6$locale === void 0 ? null : _ref6$locale,
|
|
5512
|
+
_ref6$numberingSystem = _ref6.numberingSystem,
|
|
5513
|
+
numberingSystem = _ref6$numberingSystem === void 0 ? null : _ref6$numberingSystem,
|
|
5514
|
+
_ref6$locObj = _ref6.locObj,
|
|
5515
|
+
locObj = _ref6$locObj === void 0 ? null : _ref6$locObj;
|
|
5095
5516
|
return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);
|
|
5096
5517
|
}
|
|
5097
5518
|
|
|
@@ -5107,17 +5528,17 @@ var Info = /*#__PURE__*/function () {
|
|
|
5107
5528
|
* @param {string} [opts.locObj=null] - an existing locale object to use
|
|
5108
5529
|
* @return {Array}
|
|
5109
5530
|
*/;
|
|
5110
|
-
Info.weekdaysFormat = function weekdaysFormat(length,
|
|
5531
|
+
Info.weekdaysFormat = function weekdaysFormat(length, _temp7) {
|
|
5111
5532
|
if (length === void 0) {
|
|
5112
5533
|
length = "long";
|
|
5113
5534
|
}
|
|
5114
|
-
var
|
|
5115
|
-
|
|
5116
|
-
locale =
|
|
5117
|
-
|
|
5118
|
-
numberingSystem =
|
|
5119
|
-
|
|
5120
|
-
locObj =
|
|
5535
|
+
var _ref7 = _temp7 === void 0 ? {} : _temp7,
|
|
5536
|
+
_ref7$locale = _ref7.locale,
|
|
5537
|
+
locale = _ref7$locale === void 0 ? null : _ref7$locale,
|
|
5538
|
+
_ref7$numberingSystem = _ref7.numberingSystem,
|
|
5539
|
+
numberingSystem = _ref7$numberingSystem === void 0 ? null : _ref7$numberingSystem,
|
|
5540
|
+
_ref7$locObj = _ref7.locObj,
|
|
5541
|
+
locObj = _ref7$locObj === void 0 ? null : _ref7$locObj;
|
|
5121
5542
|
return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);
|
|
5122
5543
|
}
|
|
5123
5544
|
|
|
@@ -5129,10 +5550,10 @@ var Info = /*#__PURE__*/function () {
|
|
|
5129
5550
|
* @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]
|
|
5130
5551
|
* @return {Array}
|
|
5131
5552
|
*/;
|
|
5132
|
-
Info.meridiems = function meridiems(
|
|
5133
|
-
var
|
|
5134
|
-
|
|
5135
|
-
locale =
|
|
5553
|
+
Info.meridiems = function meridiems(_temp8) {
|
|
5554
|
+
var _ref8 = _temp8 === void 0 ? {} : _temp8,
|
|
5555
|
+
_ref8$locale = _ref8.locale,
|
|
5556
|
+
locale = _ref8$locale === void 0 ? null : _ref8$locale;
|
|
5136
5557
|
return Locale.create(locale).meridiems();
|
|
5137
5558
|
}
|
|
5138
5559
|
|
|
@@ -5146,13 +5567,13 @@ var Info = /*#__PURE__*/function () {
|
|
|
5146
5567
|
* @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]
|
|
5147
5568
|
* @return {Array}
|
|
5148
5569
|
*/;
|
|
5149
|
-
Info.eras = function eras(length,
|
|
5570
|
+
Info.eras = function eras(length, _temp9) {
|
|
5150
5571
|
if (length === void 0) {
|
|
5151
5572
|
length = "short";
|
|
5152
5573
|
}
|
|
5153
|
-
var
|
|
5154
|
-
|
|
5155
|
-
locale =
|
|
5574
|
+
var _ref9 = _temp9 === void 0 ? {} : _temp9,
|
|
5575
|
+
_ref9$locale = _ref9.locale,
|
|
5576
|
+
locale = _ref9$locale === void 0 ? null : _ref9$locale;
|
|
5156
5577
|
return Locale.create(locale, null, "gregory").eras(length);
|
|
5157
5578
|
}
|
|
5158
5579
|
|
|
@@ -5161,12 +5582,14 @@ var Info = /*#__PURE__*/function () {
|
|
|
5161
5582
|
* Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case.
|
|
5162
5583
|
* Keys:
|
|
5163
5584
|
* * `relative`: whether this environment supports relative time formatting
|
|
5164
|
-
*
|
|
5585
|
+
* * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale
|
|
5586
|
+
* @example Info.features() //=> { relative: false, localeWeek: true }
|
|
5165
5587
|
* @return {Object}
|
|
5166
5588
|
*/;
|
|
5167
5589
|
Info.features = function features() {
|
|
5168
5590
|
return {
|
|
5169
|
-
relative: hasRelative()
|
|
5591
|
+
relative: hasRelative(),
|
|
5592
|
+
localeWeek: hasLocaleWeekInfo()
|
|
5170
5593
|
};
|
|
5171
5594
|
};
|
|
5172
5595
|
return Info;
|
|
@@ -5195,6 +5618,15 @@ function highOrderDiffs(cursor, later, units) {
|
|
|
5195
5618
|
var results = {};
|
|
5196
5619
|
var earlier = cursor;
|
|
5197
5620
|
var lowestOrder, highWater;
|
|
5621
|
+
|
|
5622
|
+
/* This loop tries to diff using larger units first.
|
|
5623
|
+
If we overshoot, we backtrack and try the next smaller unit.
|
|
5624
|
+
"cursor" starts out at the earlier timestamp and moves closer and closer to "later"
|
|
5625
|
+
as we use smaller and smaller units.
|
|
5626
|
+
highWater keeps track of where we would be if we added one more of the smallest unit,
|
|
5627
|
+
this is used later to potentially convert any difference smaller than the smallest higher order unit
|
|
5628
|
+
into a fraction of that smallest higher order unit
|
|
5629
|
+
*/
|
|
5198
5630
|
for (var _i = 0, _differs = differs; _i < _differs.length; _i++) {
|
|
5199
5631
|
var _differs$_i = _differs[_i],
|
|
5200
5632
|
unit = _differs$_i[0],
|
|
@@ -5204,8 +5636,20 @@ function highOrderDiffs(cursor, later, units) {
|
|
|
5204
5636
|
results[unit] = differ(cursor, later);
|
|
5205
5637
|
highWater = earlier.plus(results);
|
|
5206
5638
|
if (highWater > later) {
|
|
5639
|
+
// we overshot the end point, backtrack cursor by 1
|
|
5207
5640
|
results[unit]--;
|
|
5208
5641
|
cursor = earlier.plus(results);
|
|
5642
|
+
|
|
5643
|
+
// if we are still overshooting now, we need to backtrack again
|
|
5644
|
+
// this happens in certain situations when diffing times in different zones,
|
|
5645
|
+
// because this calculation ignores time zones
|
|
5646
|
+
if (cursor > later) {
|
|
5647
|
+
// keep the "overshot by 1" around as highWater
|
|
5648
|
+
highWater = cursor;
|
|
5649
|
+
// backtrack cursor by 1
|
|
5650
|
+
results[unit]--;
|
|
5651
|
+
cursor = earlier.plus(results);
|
|
5652
|
+
}
|
|
5209
5653
|
} else {
|
|
5210
5654
|
cursor = highWater;
|
|
5211
5655
|
}
|
|
@@ -5384,6 +5828,11 @@ function simple(regex) {
|
|
|
5384
5828
|
function escapeToken(value) {
|
|
5385
5829
|
return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
5386
5830
|
}
|
|
5831
|
+
|
|
5832
|
+
/**
|
|
5833
|
+
* @param token
|
|
5834
|
+
* @param {Locale} loc
|
|
5835
|
+
*/
|
|
5387
5836
|
function unitForToken(token, loc) {
|
|
5388
5837
|
var one = digitRegex(loc),
|
|
5389
5838
|
two = digitRegex(loc, "{2}"),
|
|
@@ -5413,9 +5862,9 @@ function unitForToken(token, loc) {
|
|
|
5413
5862
|
switch (t.val) {
|
|
5414
5863
|
// era
|
|
5415
5864
|
case "G":
|
|
5416
|
-
return oneOf(loc.eras("short"
|
|
5865
|
+
return oneOf(loc.eras("short"), 0);
|
|
5417
5866
|
case "GG":
|
|
5418
|
-
return oneOf(loc.eras("long"
|
|
5867
|
+
return oneOf(loc.eras("long"), 0);
|
|
5419
5868
|
// years
|
|
5420
5869
|
case "y":
|
|
5421
5870
|
return intUnit(oneToSix);
|
|
@@ -5433,17 +5882,17 @@ function unitForToken(token, loc) {
|
|
|
5433
5882
|
case "MM":
|
|
5434
5883
|
return intUnit(two);
|
|
5435
5884
|
case "MMM":
|
|
5436
|
-
return oneOf(loc.months("short", true
|
|
5885
|
+
return oneOf(loc.months("short", true), 1);
|
|
5437
5886
|
case "MMMM":
|
|
5438
|
-
return oneOf(loc.months("long", true
|
|
5887
|
+
return oneOf(loc.months("long", true), 1);
|
|
5439
5888
|
case "L":
|
|
5440
5889
|
return intUnit(oneOrTwo);
|
|
5441
5890
|
case "LL":
|
|
5442
5891
|
return intUnit(two);
|
|
5443
5892
|
case "LLL":
|
|
5444
|
-
return oneOf(loc.months("short", false
|
|
5893
|
+
return oneOf(loc.months("short", false), 1);
|
|
5445
5894
|
case "LLLL":
|
|
5446
|
-
return oneOf(loc.months("long", false
|
|
5895
|
+
return oneOf(loc.months("long", false), 1);
|
|
5447
5896
|
// dates
|
|
5448
5897
|
case "d":
|
|
5449
5898
|
return intUnit(oneOrTwo);
|
|
@@ -5503,13 +5952,13 @@ function unitForToken(token, loc) {
|
|
|
5503
5952
|
case "c":
|
|
5504
5953
|
return intUnit(one);
|
|
5505
5954
|
case "EEE":
|
|
5506
|
-
return oneOf(loc.weekdays("short", false
|
|
5955
|
+
return oneOf(loc.weekdays("short", false), 1);
|
|
5507
5956
|
case "EEEE":
|
|
5508
|
-
return oneOf(loc.weekdays("long", false
|
|
5957
|
+
return oneOf(loc.weekdays("long", false), 1);
|
|
5509
5958
|
case "ccc":
|
|
5510
|
-
return oneOf(loc.weekdays("short", true
|
|
5959
|
+
return oneOf(loc.weekdays("short", true), 1);
|
|
5511
5960
|
case "cccc":
|
|
5512
|
-
return oneOf(loc.weekdays("long", true
|
|
5961
|
+
return oneOf(loc.weekdays("long", true), 1);
|
|
5513
5962
|
// offset/zone
|
|
5514
5963
|
case "Z":
|
|
5515
5964
|
case "ZZ":
|
|
@@ -5555,10 +6004,14 @@ var partTypeStyleToTokenVal = {
|
|
|
5555
6004
|
},
|
|
5556
6005
|
dayperiod: "a",
|
|
5557
6006
|
dayPeriod: "a",
|
|
5558
|
-
|
|
6007
|
+
hour12: {
|
|
5559
6008
|
numeric: "h",
|
|
5560
6009
|
"2-digit": "hh"
|
|
5561
6010
|
},
|
|
6011
|
+
hour24: {
|
|
6012
|
+
numeric: "H",
|
|
6013
|
+
"2-digit": "HH"
|
|
6014
|
+
},
|
|
5562
6015
|
minute: {
|
|
5563
6016
|
numeric: "m",
|
|
5564
6017
|
"2-digit": "mm"
|
|
@@ -5572,7 +6025,7 @@ var partTypeStyleToTokenVal = {
|
|
|
5572
6025
|
short: "ZZZ"
|
|
5573
6026
|
}
|
|
5574
6027
|
};
|
|
5575
|
-
function tokenForPart(part, formatOpts) {
|
|
6028
|
+
function tokenForPart(part, formatOpts, resolvedOpts) {
|
|
5576
6029
|
var type = part.type,
|
|
5577
6030
|
value = part.value;
|
|
5578
6031
|
if (type === "literal") {
|
|
@@ -5583,7 +6036,27 @@ function tokenForPart(part, formatOpts) {
|
|
|
5583
6036
|
};
|
|
5584
6037
|
}
|
|
5585
6038
|
var style = formatOpts[type];
|
|
5586
|
-
|
|
6039
|
+
|
|
6040
|
+
// The user might have explicitly specified hour12 or hourCycle
|
|
6041
|
+
// if so, respect their decision
|
|
6042
|
+
// if not, refer back to the resolvedOpts, which are based on the locale
|
|
6043
|
+
var actualType = type;
|
|
6044
|
+
if (type === "hour") {
|
|
6045
|
+
if (formatOpts.hour12 != null) {
|
|
6046
|
+
actualType = formatOpts.hour12 ? "hour12" : "hour24";
|
|
6047
|
+
} else if (formatOpts.hourCycle != null) {
|
|
6048
|
+
if (formatOpts.hourCycle === "h11" || formatOpts.hourCycle === "h12") {
|
|
6049
|
+
actualType = "hour12";
|
|
6050
|
+
} else {
|
|
6051
|
+
actualType = "hour24";
|
|
6052
|
+
}
|
|
6053
|
+
} else {
|
|
6054
|
+
// tokens only differentiate between 24 hours or not,
|
|
6055
|
+
// so we do not need to check hourCycle here, which is less supported anyways
|
|
6056
|
+
actualType = resolvedOpts.hour12 ? "hour12" : "hour24";
|
|
6057
|
+
}
|
|
6058
|
+
}
|
|
6059
|
+
var val = partTypeStyleToTokenVal[actualType];
|
|
5587
6060
|
if (typeof val === "object") {
|
|
5588
6061
|
val = val[style];
|
|
5589
6062
|
}
|
|
@@ -5776,168 +6249,14 @@ function formatOptsToTokens(formatOpts, locale) {
|
|
|
5776
6249
|
return null;
|
|
5777
6250
|
}
|
|
5778
6251
|
var formatter = Formatter.create(locale, formatOpts);
|
|
5779
|
-
var
|
|
6252
|
+
var df = formatter.dtFormatter(getDummyDateTime());
|
|
6253
|
+
var parts = df.formatToParts();
|
|
6254
|
+
var resolvedOpts = df.resolvedOptions();
|
|
5780
6255
|
return parts.map(function (p) {
|
|
5781
|
-
return tokenForPart(p, formatOpts);
|
|
6256
|
+
return tokenForPart(p, formatOpts, resolvedOpts);
|
|
5782
6257
|
});
|
|
5783
6258
|
}
|
|
5784
6259
|
|
|
5785
|
-
var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
|
|
5786
|
-
leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
|
|
5787
|
-
function unitOutOfRange(unit, value) {
|
|
5788
|
-
return new Invalid("unit out of range", "you specified " + value + " (of type " + typeof value + ") as a " + unit + ", which is invalid");
|
|
5789
|
-
}
|
|
5790
|
-
function dayOfWeek(year, month, day) {
|
|
5791
|
-
var d = new Date(Date.UTC(year, month - 1, day));
|
|
5792
|
-
if (year < 100 && year >= 0) {
|
|
5793
|
-
d.setUTCFullYear(d.getUTCFullYear() - 1900);
|
|
5794
|
-
}
|
|
5795
|
-
var js = d.getUTCDay();
|
|
5796
|
-
return js === 0 ? 7 : js;
|
|
5797
|
-
}
|
|
5798
|
-
function computeOrdinal(year, month, day) {
|
|
5799
|
-
return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
|
|
5800
|
-
}
|
|
5801
|
-
function uncomputeOrdinal(year, ordinal) {
|
|
5802
|
-
var table = isLeapYear(year) ? leapLadder : nonLeapLadder,
|
|
5803
|
-
month0 = table.findIndex(function (i) {
|
|
5804
|
-
return i < ordinal;
|
|
5805
|
-
}),
|
|
5806
|
-
day = ordinal - table[month0];
|
|
5807
|
-
return {
|
|
5808
|
-
month: month0 + 1,
|
|
5809
|
-
day: day
|
|
5810
|
-
};
|
|
5811
|
-
}
|
|
5812
|
-
|
|
5813
|
-
/**
|
|
5814
|
-
* @private
|
|
5815
|
-
*/
|
|
5816
|
-
|
|
5817
|
-
function gregorianToWeek(gregObj) {
|
|
5818
|
-
var year = gregObj.year,
|
|
5819
|
-
month = gregObj.month,
|
|
5820
|
-
day = gregObj.day,
|
|
5821
|
-
ordinal = computeOrdinal(year, month, day),
|
|
5822
|
-
weekday = dayOfWeek(year, month, day);
|
|
5823
|
-
var weekNumber = Math.floor((ordinal - weekday + 10) / 7),
|
|
5824
|
-
weekYear;
|
|
5825
|
-
if (weekNumber < 1) {
|
|
5826
|
-
weekYear = year - 1;
|
|
5827
|
-
weekNumber = weeksInWeekYear(weekYear);
|
|
5828
|
-
} else if (weekNumber > weeksInWeekYear(year)) {
|
|
5829
|
-
weekYear = year + 1;
|
|
5830
|
-
weekNumber = 1;
|
|
5831
|
-
} else {
|
|
5832
|
-
weekYear = year;
|
|
5833
|
-
}
|
|
5834
|
-
return _extends({
|
|
5835
|
-
weekYear: weekYear,
|
|
5836
|
-
weekNumber: weekNumber,
|
|
5837
|
-
weekday: weekday
|
|
5838
|
-
}, timeObject(gregObj));
|
|
5839
|
-
}
|
|
5840
|
-
function weekToGregorian(weekData) {
|
|
5841
|
-
var weekYear = weekData.weekYear,
|
|
5842
|
-
weekNumber = weekData.weekNumber,
|
|
5843
|
-
weekday = weekData.weekday,
|
|
5844
|
-
weekdayOfJan4 = dayOfWeek(weekYear, 1, 4),
|
|
5845
|
-
yearInDays = daysInYear(weekYear);
|
|
5846
|
-
var ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3,
|
|
5847
|
-
year;
|
|
5848
|
-
if (ordinal < 1) {
|
|
5849
|
-
year = weekYear - 1;
|
|
5850
|
-
ordinal += daysInYear(year);
|
|
5851
|
-
} else if (ordinal > yearInDays) {
|
|
5852
|
-
year = weekYear + 1;
|
|
5853
|
-
ordinal -= daysInYear(weekYear);
|
|
5854
|
-
} else {
|
|
5855
|
-
year = weekYear;
|
|
5856
|
-
}
|
|
5857
|
-
var _uncomputeOrdinal = uncomputeOrdinal(year, ordinal),
|
|
5858
|
-
month = _uncomputeOrdinal.month,
|
|
5859
|
-
day = _uncomputeOrdinal.day;
|
|
5860
|
-
return _extends({
|
|
5861
|
-
year: year,
|
|
5862
|
-
month: month,
|
|
5863
|
-
day: day
|
|
5864
|
-
}, timeObject(weekData));
|
|
5865
|
-
}
|
|
5866
|
-
function gregorianToOrdinal(gregData) {
|
|
5867
|
-
var year = gregData.year,
|
|
5868
|
-
month = gregData.month,
|
|
5869
|
-
day = gregData.day;
|
|
5870
|
-
var ordinal = computeOrdinal(year, month, day);
|
|
5871
|
-
return _extends({
|
|
5872
|
-
year: year,
|
|
5873
|
-
ordinal: ordinal
|
|
5874
|
-
}, timeObject(gregData));
|
|
5875
|
-
}
|
|
5876
|
-
function ordinalToGregorian(ordinalData) {
|
|
5877
|
-
var year = ordinalData.year,
|
|
5878
|
-
ordinal = ordinalData.ordinal;
|
|
5879
|
-
var _uncomputeOrdinal2 = uncomputeOrdinal(year, ordinal),
|
|
5880
|
-
month = _uncomputeOrdinal2.month,
|
|
5881
|
-
day = _uncomputeOrdinal2.day;
|
|
5882
|
-
return _extends({
|
|
5883
|
-
year: year,
|
|
5884
|
-
month: month,
|
|
5885
|
-
day: day
|
|
5886
|
-
}, timeObject(ordinalData));
|
|
5887
|
-
}
|
|
5888
|
-
function hasInvalidWeekData(obj) {
|
|
5889
|
-
var validYear = isInteger(obj.weekYear),
|
|
5890
|
-
validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)),
|
|
5891
|
-
validWeekday = integerBetween(obj.weekday, 1, 7);
|
|
5892
|
-
if (!validYear) {
|
|
5893
|
-
return unitOutOfRange("weekYear", obj.weekYear);
|
|
5894
|
-
} else if (!validWeek) {
|
|
5895
|
-
return unitOutOfRange("week", obj.week);
|
|
5896
|
-
} else if (!validWeekday) {
|
|
5897
|
-
return unitOutOfRange("weekday", obj.weekday);
|
|
5898
|
-
} else return false;
|
|
5899
|
-
}
|
|
5900
|
-
function hasInvalidOrdinalData(obj) {
|
|
5901
|
-
var validYear = isInteger(obj.year),
|
|
5902
|
-
validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
|
|
5903
|
-
if (!validYear) {
|
|
5904
|
-
return unitOutOfRange("year", obj.year);
|
|
5905
|
-
} else if (!validOrdinal) {
|
|
5906
|
-
return unitOutOfRange("ordinal", obj.ordinal);
|
|
5907
|
-
} else return false;
|
|
5908
|
-
}
|
|
5909
|
-
function hasInvalidGregorianData(obj) {
|
|
5910
|
-
var validYear = isInteger(obj.year),
|
|
5911
|
-
validMonth = integerBetween(obj.month, 1, 12),
|
|
5912
|
-
validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
|
|
5913
|
-
if (!validYear) {
|
|
5914
|
-
return unitOutOfRange("year", obj.year);
|
|
5915
|
-
} else if (!validMonth) {
|
|
5916
|
-
return unitOutOfRange("month", obj.month);
|
|
5917
|
-
} else if (!validDay) {
|
|
5918
|
-
return unitOutOfRange("day", obj.day);
|
|
5919
|
-
} else return false;
|
|
5920
|
-
}
|
|
5921
|
-
function hasInvalidTimeData(obj) {
|
|
5922
|
-
var hour = obj.hour,
|
|
5923
|
-
minute = obj.minute,
|
|
5924
|
-
second = obj.second,
|
|
5925
|
-
millisecond = obj.millisecond;
|
|
5926
|
-
var validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0,
|
|
5927
|
-
validMinute = integerBetween(minute, 0, 59),
|
|
5928
|
-
validSecond = integerBetween(second, 0, 59),
|
|
5929
|
-
validMillisecond = integerBetween(millisecond, 0, 999);
|
|
5930
|
-
if (!validHour) {
|
|
5931
|
-
return unitOutOfRange("hour", hour);
|
|
5932
|
-
} else if (!validMinute) {
|
|
5933
|
-
return unitOutOfRange("minute", minute);
|
|
5934
|
-
} else if (!validSecond) {
|
|
5935
|
-
return unitOutOfRange("second", second);
|
|
5936
|
-
} else if (!validMillisecond) {
|
|
5937
|
-
return unitOutOfRange("millisecond", millisecond);
|
|
5938
|
-
} else return false;
|
|
5939
|
-
}
|
|
5940
|
-
|
|
5941
6260
|
var INVALID = "Invalid DateTime";
|
|
5942
6261
|
var MAX_DATE = 8.64e15;
|
|
5943
6262
|
function unsupportedZone(zone) {
|
|
@@ -5945,6 +6264,9 @@ function unsupportedZone(zone) {
|
|
|
5945
6264
|
}
|
|
5946
6265
|
|
|
5947
6266
|
// we cache week data on the DT object and this intermediates the cache
|
|
6267
|
+
/**
|
|
6268
|
+
* @param {DateTime} dt
|
|
6269
|
+
*/
|
|
5948
6270
|
function possiblyCachedWeekData(dt) {
|
|
5949
6271
|
if (dt.weekData === null) {
|
|
5950
6272
|
dt.weekData = gregorianToWeek(dt.c);
|
|
@@ -5952,6 +6274,16 @@ function possiblyCachedWeekData(dt) {
|
|
|
5952
6274
|
return dt.weekData;
|
|
5953
6275
|
}
|
|
5954
6276
|
|
|
6277
|
+
/**
|
|
6278
|
+
* @param {DateTime} dt
|
|
6279
|
+
*/
|
|
6280
|
+
function possiblyCachedLocalWeekData(dt) {
|
|
6281
|
+
if (dt.localWeekData === null) {
|
|
6282
|
+
dt.localWeekData = gregorianToWeek(dt.c, dt.loc.getMinDaysInFirstWeek(), dt.loc.getStartOfWeek());
|
|
6283
|
+
}
|
|
6284
|
+
return dt.localWeekData;
|
|
6285
|
+
}
|
|
6286
|
+
|
|
5955
6287
|
// clone really means, "make a new object with these modifications". all "setters" really use this
|
|
5956
6288
|
// to create a new object while only changing some of the properties
|
|
5957
6289
|
function clone(inst, alts) {
|
|
@@ -6100,13 +6432,13 @@ function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeO
|
|
|
6100
6432
|
if (extended) {
|
|
6101
6433
|
c += ":";
|
|
6102
6434
|
c += padStart(o.c.minute);
|
|
6103
|
-
if (o.c.second !== 0 || !suppressSeconds) {
|
|
6435
|
+
if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
|
|
6104
6436
|
c += ":";
|
|
6105
6437
|
}
|
|
6106
6438
|
} else {
|
|
6107
6439
|
c += padStart(o.c.minute);
|
|
6108
6440
|
}
|
|
6109
|
-
if (o.c.second !== 0 || !suppressSeconds) {
|
|
6441
|
+
if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
|
|
6110
6442
|
c += padStart(o.c.second);
|
|
6111
6443
|
if (o.c.millisecond !== 0 || !suppressMilliseconds) {
|
|
6112
6444
|
c += ".";
|
|
@@ -6195,6 +6527,21 @@ function normalizeUnit(unit) {
|
|
|
6195
6527
|
if (!normalized) throw new InvalidUnitError(unit);
|
|
6196
6528
|
return normalized;
|
|
6197
6529
|
}
|
|
6530
|
+
function normalizeUnitWithLocalWeeks(unit) {
|
|
6531
|
+
switch (unit.toLowerCase()) {
|
|
6532
|
+
case "localweekday":
|
|
6533
|
+
case "localweekdays":
|
|
6534
|
+
return "localWeekday";
|
|
6535
|
+
case "localweeknumber":
|
|
6536
|
+
case "localweeknumbers":
|
|
6537
|
+
return "localWeekNumber";
|
|
6538
|
+
case "localweekyear":
|
|
6539
|
+
case "localweekyears":
|
|
6540
|
+
return "localWeekYear";
|
|
6541
|
+
default:
|
|
6542
|
+
return normalizeUnit(unit);
|
|
6543
|
+
}
|
|
6544
|
+
}
|
|
6198
6545
|
|
|
6199
6546
|
// this is a dumbed down version of fromObject() that runs about 60% faster
|
|
6200
6547
|
// but doesn't do any validation, makes a bunch of assumptions about what units
|
|
@@ -6291,7 +6638,7 @@ function lastOpts(argList) {
|
|
|
6291
6638
|
*
|
|
6292
6639
|
* There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation.
|
|
6293
6640
|
*/
|
|
6294
|
-
var DateTime = /*#__PURE__*/function () {
|
|
6641
|
+
var DateTime = /*#__PURE__*/function (_Symbol$for) {
|
|
6295
6642
|
/**
|
|
6296
6643
|
* @access private
|
|
6297
6644
|
*/
|
|
@@ -6335,6 +6682,10 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6335
6682
|
* @access private
|
|
6336
6683
|
*/
|
|
6337
6684
|
this.weekData = null;
|
|
6685
|
+
/**
|
|
6686
|
+
* @access private
|
|
6687
|
+
*/
|
|
6688
|
+
this.localWeekData = null;
|
|
6338
6689
|
/**
|
|
6339
6690
|
* @access private
|
|
6340
6691
|
*/
|
|
@@ -6541,13 +6892,16 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6541
6892
|
* @param {number} obj.weekYear - an ISO week year
|
|
6542
6893
|
* @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year
|
|
6543
6894
|
* @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday
|
|
6895
|
+
* @param {number} obj.localWeekYear - a week year, according to the locale
|
|
6896
|
+
* @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale
|
|
6897
|
+
* @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale
|
|
6544
6898
|
* @param {number} obj.hour - hour of the day, 0-23
|
|
6545
6899
|
* @param {number} obj.minute - minute of the hour, 0-59
|
|
6546
6900
|
* @param {number} obj.second - second of the minute, 0-59
|
|
6547
6901
|
* @param {number} obj.millisecond - millisecond of the second, 0-999
|
|
6548
6902
|
* @param {Object} opts - options for creating this DateTime
|
|
6549
6903
|
* @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()
|
|
6550
|
-
* @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance
|
|
6904
|
+
* @param {string} [opts.locale='system\'s locale'] - a locale to set on the resulting DateTime instance
|
|
6551
6905
|
* @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
|
|
6552
6906
|
* @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance
|
|
6553
6907
|
* @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'
|
|
@@ -6557,6 +6911,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6557
6911
|
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' })
|
|
6558
6912
|
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' })
|
|
6559
6913
|
* @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'
|
|
6914
|
+
* @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: "en-US" }).toISODate() //=> '2021-12-26'
|
|
6560
6915
|
* @return {DateTime}
|
|
6561
6916
|
*/;
|
|
6562
6917
|
DateTime.fromObject = function fromObject(obj, opts) {
|
|
@@ -6568,15 +6923,18 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6568
6923
|
if (!zoneToUse.isValid) {
|
|
6569
6924
|
return DateTime.invalid(unsupportedZone(zoneToUse));
|
|
6570
6925
|
}
|
|
6926
|
+
var loc = Locale.fromObject(opts);
|
|
6927
|
+
var normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);
|
|
6928
|
+
var _usesLocalWeekValues = usesLocalWeekValues(normalized, loc),
|
|
6929
|
+
minDaysInFirstWeek = _usesLocalWeekValues.minDaysInFirstWeek,
|
|
6930
|
+
startOfWeek = _usesLocalWeekValues.startOfWeek;
|
|
6571
6931
|
var tsNow = Settings.now(),
|
|
6572
6932
|
offsetProvis = !isUndefined(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow),
|
|
6573
|
-
normalized = normalizeObject(obj, normalizeUnit),
|
|
6574
6933
|
containsOrdinal = !isUndefined(normalized.ordinal),
|
|
6575
6934
|
containsGregorYear = !isUndefined(normalized.year),
|
|
6576
6935
|
containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),
|
|
6577
6936
|
containsGregor = containsGregorYear || containsGregorMD,
|
|
6578
|
-
definiteWeekDef = normalized.weekYear || normalized.weekNumber
|
|
6579
|
-
loc = Locale.fromObject(opts);
|
|
6937
|
+
definiteWeekDef = normalized.weekYear || normalized.weekNumber;
|
|
6580
6938
|
|
|
6581
6939
|
// cases:
|
|
6582
6940
|
// just a weekday -> this week's instance of that weekday, no worries
|
|
@@ -6599,7 +6957,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6599
6957
|
if (useWeekData) {
|
|
6600
6958
|
units = orderedWeekUnits;
|
|
6601
6959
|
defaultValues = defaultWeekUnitValues;
|
|
6602
|
-
objNow = gregorianToWeek(objNow);
|
|
6960
|
+
objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek);
|
|
6603
6961
|
} else if (containsOrdinal) {
|
|
6604
6962
|
units = orderedOrdinalUnits;
|
|
6605
6963
|
defaultValues = defaultOrdinalUnitValues;
|
|
@@ -6624,14 +6982,14 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6624
6982
|
}
|
|
6625
6983
|
|
|
6626
6984
|
// make sure the values we have are in range
|
|
6627
|
-
var higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized),
|
|
6985
|
+
var higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized),
|
|
6628
6986
|
invalid = higherOrderInvalid || hasInvalidTimeData(normalized);
|
|
6629
6987
|
if (invalid) {
|
|
6630
6988
|
return DateTime.invalid(invalid);
|
|
6631
6989
|
}
|
|
6632
6990
|
|
|
6633
6991
|
// compute the actual time
|
|
6634
|
-
var gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized,
|
|
6992
|
+
var gregorian = useWeekData ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? ordinalToGregorian(normalized) : normalized,
|
|
6635
6993
|
_objToTS2 = objToTS(gregorian, offsetProvis, zoneToUse),
|
|
6636
6994
|
tsFinal = _objToTS2[0],
|
|
6637
6995
|
offsetFinal = _objToTS2[1],
|
|
@@ -6808,7 +7166,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6808
7166
|
|
|
6809
7167
|
/**
|
|
6810
7168
|
* Create an invalid DateTime.
|
|
6811
|
-
* @param {
|
|
7169
|
+
* @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent.
|
|
6812
7170
|
* @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information
|
|
6813
7171
|
* @return {DateTime}
|
|
6814
7172
|
*/;
|
|
@@ -6891,6 +7249,47 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6891
7249
|
* * The DateTime was created by an operation on another invalid date
|
|
6892
7250
|
* @type {boolean}
|
|
6893
7251
|
*/;
|
|
7252
|
+
/**
|
|
7253
|
+
* Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC
|
|
7254
|
+
* in this DateTime's zone. During DST changes local time can be ambiguous, for example
|
|
7255
|
+
* `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`.
|
|
7256
|
+
* This method will return both possible DateTimes if this DateTime's local time is ambiguous.
|
|
7257
|
+
* @returns {DateTime[]}
|
|
7258
|
+
*/
|
|
7259
|
+
_proto.getPossibleOffsets = function getPossibleOffsets() {
|
|
7260
|
+
if (!this.isValid || this.isOffsetFixed) {
|
|
7261
|
+
return [this];
|
|
7262
|
+
}
|
|
7263
|
+
var dayMs = 86400000;
|
|
7264
|
+
var minuteMs = 60000;
|
|
7265
|
+
var localTS = objToLocalTS(this.c);
|
|
7266
|
+
var oEarlier = this.zone.offset(localTS - dayMs);
|
|
7267
|
+
var oLater = this.zone.offset(localTS + dayMs);
|
|
7268
|
+
var o1 = this.zone.offset(localTS - oEarlier * minuteMs);
|
|
7269
|
+
var o2 = this.zone.offset(localTS - oLater * minuteMs);
|
|
7270
|
+
if (o1 === o2) {
|
|
7271
|
+
return [this];
|
|
7272
|
+
}
|
|
7273
|
+
var ts1 = localTS - o1 * minuteMs;
|
|
7274
|
+
var ts2 = localTS - o2 * minuteMs;
|
|
7275
|
+
var c1 = tsToObj(ts1, o1);
|
|
7276
|
+
var c2 = tsToObj(ts2, o2);
|
|
7277
|
+
if (c1.hour === c2.hour && c1.minute === c2.minute && c1.second === c2.second && c1.millisecond === c2.millisecond) {
|
|
7278
|
+
return [clone(this, {
|
|
7279
|
+
ts: ts1
|
|
7280
|
+
}), clone(this, {
|
|
7281
|
+
ts: ts2
|
|
7282
|
+
})];
|
|
7283
|
+
}
|
|
7284
|
+
return [this];
|
|
7285
|
+
}
|
|
7286
|
+
|
|
7287
|
+
/**
|
|
7288
|
+
* Returns true if this DateTime is in a leap year, false otherwise
|
|
7289
|
+
* @example DateTime.local(2016).isInLeapYear //=> true
|
|
7290
|
+
* @example DateTime.local(2013).isInLeapYear //=> false
|
|
7291
|
+
* @type {boolean}
|
|
7292
|
+
*/;
|
|
6894
7293
|
/**
|
|
6895
7294
|
* Returns the resolved Intl options for this DateTime.
|
|
6896
7295
|
* This is useful in understanding the behavior of formatting methods
|
|
@@ -7013,6 +7412,9 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7013
7412
|
/**
|
|
7014
7413
|
* "Set" the values of specified units. Returns a newly-constructed DateTime.
|
|
7015
7414
|
* You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}.
|
|
7415
|
+
*
|
|
7416
|
+
* This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`.
|
|
7417
|
+
* They cannot be mixed with ISO-week units like `weekday`.
|
|
7016
7418
|
* @param {Object} values - a mapping of units to numbers
|
|
7017
7419
|
* @example dt.set({ year: 2017 })
|
|
7018
7420
|
* @example dt.set({ hour: 8, minute: 30 })
|
|
@@ -7022,8 +7424,11 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7022
7424
|
*/;
|
|
7023
7425
|
_proto.set = function set(values) {
|
|
7024
7426
|
if (!this.isValid) return this;
|
|
7025
|
-
var normalized = normalizeObject(values,
|
|
7026
|
-
|
|
7427
|
+
var normalized = normalizeObject(values, normalizeUnitWithLocalWeeks);
|
|
7428
|
+
var _usesLocalWeekValues2 = usesLocalWeekValues(normalized, this.loc),
|
|
7429
|
+
minDaysInFirstWeek = _usesLocalWeekValues2.minDaysInFirstWeek,
|
|
7430
|
+
startOfWeek = _usesLocalWeekValues2.startOfWeek;
|
|
7431
|
+
var settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday),
|
|
7027
7432
|
containsOrdinal = !isUndefined(normalized.ordinal),
|
|
7028
7433
|
containsGregorYear = !isUndefined(normalized.year),
|
|
7029
7434
|
containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),
|
|
@@ -7037,7 +7442,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7037
7442
|
}
|
|
7038
7443
|
var mixed;
|
|
7039
7444
|
if (settingWeekStuff) {
|
|
7040
|
-
mixed = weekToGregorian(_extends({}, gregorianToWeek(this.c), normalized));
|
|
7445
|
+
mixed = weekToGregorian(_extends({}, gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek), normalized), minDaysInFirstWeek, startOfWeek);
|
|
7041
7446
|
} else if (!isUndefined(normalized.ordinal)) {
|
|
7042
7447
|
mixed = ordinalToGregorian(_extends({}, gregorianToOrdinal(this.c), normalized));
|
|
7043
7448
|
} else {
|
|
@@ -7092,6 +7497,8 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7092
7497
|
/**
|
|
7093
7498
|
* "Set" this DateTime to the beginning of a unit of time.
|
|
7094
7499
|
* @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
|
|
7500
|
+
* @param {Object} opts - options
|
|
7501
|
+
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
|
|
7095
7502
|
* @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'
|
|
7096
7503
|
* @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'
|
|
7097
7504
|
* @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays
|
|
@@ -7099,7 +7506,10 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7099
7506
|
* @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'
|
|
7100
7507
|
* @return {DateTime}
|
|
7101
7508
|
*/;
|
|
7102
|
-
_proto.startOf = function startOf(unit) {
|
|
7509
|
+
_proto.startOf = function startOf(unit, _temp3) {
|
|
7510
|
+
var _ref4 = _temp3 === void 0 ? {} : _temp3,
|
|
7511
|
+
_ref4$useLocaleWeeks = _ref4.useLocaleWeeks,
|
|
7512
|
+
useLocaleWeeks = _ref4$useLocaleWeeks === void 0 ? false : _ref4$useLocaleWeeks;
|
|
7103
7513
|
if (!this.isValid) return this;
|
|
7104
7514
|
var o = {},
|
|
7105
7515
|
normalizedUnit = Duration.normalizeUnit(unit);
|
|
@@ -7128,7 +7538,16 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7128
7538
|
}
|
|
7129
7539
|
|
|
7130
7540
|
if (normalizedUnit === "weeks") {
|
|
7131
|
-
|
|
7541
|
+
if (useLocaleWeeks) {
|
|
7542
|
+
var startOfWeek = this.loc.getStartOfWeek();
|
|
7543
|
+
var weekday = this.weekday;
|
|
7544
|
+
if (weekday < startOfWeek) {
|
|
7545
|
+
o.weekNumber = this.weekNumber - 1;
|
|
7546
|
+
}
|
|
7547
|
+
o.weekday = startOfWeek;
|
|
7548
|
+
} else {
|
|
7549
|
+
o.weekday = 1;
|
|
7550
|
+
}
|
|
7132
7551
|
}
|
|
7133
7552
|
if (normalizedUnit === "quarters") {
|
|
7134
7553
|
var q = Math.ceil(this.month / 3);
|
|
@@ -7140,6 +7559,8 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7140
7559
|
/**
|
|
7141
7560
|
* "Set" this DateTime to the end (meaning the last millisecond) of a unit of time
|
|
7142
7561
|
* @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
|
|
7562
|
+
* @param {Object} opts - options
|
|
7563
|
+
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
|
|
7143
7564
|
* @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'
|
|
7144
7565
|
* @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'
|
|
7145
7566
|
* @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays
|
|
@@ -7147,9 +7568,9 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7147
7568
|
* @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'
|
|
7148
7569
|
* @return {DateTime}
|
|
7149
7570
|
*/;
|
|
7150
|
-
_proto.endOf = function endOf(unit) {
|
|
7571
|
+
_proto.endOf = function endOf(unit, opts) {
|
|
7151
7572
|
var _this$plus;
|
|
7152
|
-
return this.isValid ? this.plus((_this$plus = {}, _this$plus[unit] = 1, _this$plus)).startOf(unit).minus(1) : this;
|
|
7573
|
+
return this.isValid ? this.plus((_this$plus = {}, _this$plus[unit] = 1, _this$plus)).startOf(unit, opts).minus(1) : this;
|
|
7153
7574
|
}
|
|
7154
7575
|
|
|
7155
7576
|
// OUTPUT
|
|
@@ -7236,18 +7657,18 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7236
7657
|
* @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
|
|
7237
7658
|
* @return {string}
|
|
7238
7659
|
*/;
|
|
7239
|
-
_proto.toISO = function toISO(
|
|
7240
|
-
var
|
|
7241
|
-
|
|
7242
|
-
format =
|
|
7243
|
-
|
|
7244
|
-
suppressSeconds =
|
|
7245
|
-
|
|
7246
|
-
suppressMilliseconds =
|
|
7247
|
-
|
|
7248
|
-
includeOffset =
|
|
7249
|
-
|
|
7250
|
-
extendedZone =
|
|
7660
|
+
_proto.toISO = function toISO(_temp4) {
|
|
7661
|
+
var _ref5 = _temp4 === void 0 ? {} : _temp4,
|
|
7662
|
+
_ref5$format = _ref5.format,
|
|
7663
|
+
format = _ref5$format === void 0 ? "extended" : _ref5$format,
|
|
7664
|
+
_ref5$suppressSeconds = _ref5.suppressSeconds,
|
|
7665
|
+
suppressSeconds = _ref5$suppressSeconds === void 0 ? false : _ref5$suppressSeconds,
|
|
7666
|
+
_ref5$suppressMillise = _ref5.suppressMilliseconds,
|
|
7667
|
+
suppressMilliseconds = _ref5$suppressMillise === void 0 ? false : _ref5$suppressMillise,
|
|
7668
|
+
_ref5$includeOffset = _ref5.includeOffset,
|
|
7669
|
+
includeOffset = _ref5$includeOffset === void 0 ? true : _ref5$includeOffset,
|
|
7670
|
+
_ref5$extendedZone = _ref5.extendedZone,
|
|
7671
|
+
extendedZone = _ref5$extendedZone === void 0 ? false : _ref5$extendedZone;
|
|
7251
7672
|
if (!this.isValid) {
|
|
7252
7673
|
return null;
|
|
7253
7674
|
}
|
|
@@ -7266,10 +7687,10 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7266
7687
|
* @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'
|
|
7267
7688
|
* @return {string}
|
|
7268
7689
|
*/;
|
|
7269
|
-
_proto.toISODate = function toISODate(
|
|
7270
|
-
var
|
|
7271
|
-
|
|
7272
|
-
format =
|
|
7690
|
+
_proto.toISODate = function toISODate(_temp5) {
|
|
7691
|
+
var _ref6 = _temp5 === void 0 ? {} : _temp5,
|
|
7692
|
+
_ref6$format = _ref6.format,
|
|
7693
|
+
format = _ref6$format === void 0 ? "extended" : _ref6$format;
|
|
7273
7694
|
if (!this.isValid) {
|
|
7274
7695
|
return null;
|
|
7275
7696
|
}
|
|
@@ -7300,20 +7721,20 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7300
7721
|
* @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'
|
|
7301
7722
|
* @return {string}
|
|
7302
7723
|
*/;
|
|
7303
|
-
_proto.toISOTime = function toISOTime(
|
|
7304
|
-
var
|
|
7305
|
-
|
|
7306
|
-
suppressMilliseconds =
|
|
7307
|
-
|
|
7308
|
-
suppressSeconds =
|
|
7309
|
-
|
|
7310
|
-
includeOffset =
|
|
7311
|
-
|
|
7312
|
-
includePrefix =
|
|
7313
|
-
|
|
7314
|
-
extendedZone =
|
|
7315
|
-
|
|
7316
|
-
format =
|
|
7724
|
+
_proto.toISOTime = function toISOTime(_temp6) {
|
|
7725
|
+
var _ref7 = _temp6 === void 0 ? {} : _temp6,
|
|
7726
|
+
_ref7$suppressMillise = _ref7.suppressMilliseconds,
|
|
7727
|
+
suppressMilliseconds = _ref7$suppressMillise === void 0 ? false : _ref7$suppressMillise,
|
|
7728
|
+
_ref7$suppressSeconds = _ref7.suppressSeconds,
|
|
7729
|
+
suppressSeconds = _ref7$suppressSeconds === void 0 ? false : _ref7$suppressSeconds,
|
|
7730
|
+
_ref7$includeOffset = _ref7.includeOffset,
|
|
7731
|
+
includeOffset = _ref7$includeOffset === void 0 ? true : _ref7$includeOffset,
|
|
7732
|
+
_ref7$includePrefix = _ref7.includePrefix,
|
|
7733
|
+
includePrefix = _ref7$includePrefix === void 0 ? false : _ref7$includePrefix,
|
|
7734
|
+
_ref7$extendedZone = _ref7.extendedZone,
|
|
7735
|
+
extendedZone = _ref7$extendedZone === void 0 ? false : _ref7$extendedZone,
|
|
7736
|
+
_ref7$format = _ref7.format,
|
|
7737
|
+
format = _ref7$format === void 0 ? "extended" : _ref7$format;
|
|
7317
7738
|
if (!this.isValid) {
|
|
7318
7739
|
return null;
|
|
7319
7740
|
}
|
|
@@ -7367,14 +7788,14 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7367
7788
|
* @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'
|
|
7368
7789
|
* @return {string}
|
|
7369
7790
|
*/;
|
|
7370
|
-
_proto.toSQLTime = function toSQLTime(
|
|
7371
|
-
var
|
|
7372
|
-
|
|
7373
|
-
includeOffset =
|
|
7374
|
-
|
|
7375
|
-
includeZone =
|
|
7376
|
-
|
|
7377
|
-
includeOffsetSpace =
|
|
7791
|
+
_proto.toSQLTime = function toSQLTime(_temp7) {
|
|
7792
|
+
var _ref8 = _temp7 === void 0 ? {} : _temp7,
|
|
7793
|
+
_ref8$includeOffset = _ref8.includeOffset,
|
|
7794
|
+
includeOffset = _ref8$includeOffset === void 0 ? true : _ref8$includeOffset,
|
|
7795
|
+
_ref8$includeZone = _ref8.includeZone,
|
|
7796
|
+
includeZone = _ref8$includeZone === void 0 ? false : _ref8$includeZone,
|
|
7797
|
+
_ref8$includeOffsetSp = _ref8.includeOffsetSpace,
|
|
7798
|
+
includeOffsetSpace = _ref8$includeOffsetSp === void 0 ? true : _ref8$includeOffsetSp;
|
|
7378
7799
|
var fmt = "HH:mm:ss.SSS";
|
|
7379
7800
|
if (includeZone || includeOffset) {
|
|
7380
7801
|
if (includeOffsetSpace) {
|
|
@@ -7419,6 +7840,18 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7419
7840
|
return this.isValid ? this.toISO() : INVALID;
|
|
7420
7841
|
}
|
|
7421
7842
|
|
|
7843
|
+
/**
|
|
7844
|
+
* Returns a string representation of this DateTime appropriate for the REPL.
|
|
7845
|
+
* @return {string}
|
|
7846
|
+
*/;
|
|
7847
|
+
_proto[_Symbol$for] = function () {
|
|
7848
|
+
if (this.isValid) {
|
|
7849
|
+
return "DateTime { ts: " + this.toISO() + ", zone: " + this.zone.name + ", locale: " + this.locale + " }";
|
|
7850
|
+
} else {
|
|
7851
|
+
return "DateTime { Invalid, reason: " + this.invalidReason + " }";
|
|
7852
|
+
}
|
|
7853
|
+
}
|
|
7854
|
+
|
|
7422
7855
|
/**
|
|
7423
7856
|
* Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis}
|
|
7424
7857
|
* @return {number}
|
|
@@ -7568,16 +8001,18 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7568
8001
|
* Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed.
|
|
7569
8002
|
* @param {DateTime} otherDateTime - the other DateTime
|
|
7570
8003
|
* @param {string} unit - the unit of time to check sameness on
|
|
8004
|
+
* @param {Object} opts - options
|
|
8005
|
+
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used
|
|
7571
8006
|
* @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day
|
|
7572
8007
|
* @return {boolean}
|
|
7573
8008
|
*/;
|
|
7574
|
-
_proto.hasSame = function hasSame(otherDateTime, unit) {
|
|
8009
|
+
_proto.hasSame = function hasSame(otherDateTime, unit, opts) {
|
|
7575
8010
|
if (!this.isValid) return false;
|
|
7576
8011
|
var inputMs = otherDateTime.valueOf();
|
|
7577
8012
|
var adjustedToZone = this.setZone(otherDateTime.zone, {
|
|
7578
8013
|
keepLocalTime: true
|
|
7579
8014
|
});
|
|
7580
|
-
return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit);
|
|
8015
|
+
return adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts);
|
|
7581
8016
|
}
|
|
7582
8017
|
|
|
7583
8018
|
/**
|
|
@@ -7938,6 +8373,51 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7938
8373
|
return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;
|
|
7939
8374
|
}
|
|
7940
8375
|
|
|
8376
|
+
/**
|
|
8377
|
+
* Returns true if this date is on a weekend according to the locale, false otherwise
|
|
8378
|
+
* @returns {boolean}
|
|
8379
|
+
*/
|
|
8380
|
+
}, {
|
|
8381
|
+
key: "isWeekend",
|
|
8382
|
+
get: function get() {
|
|
8383
|
+
return this.isValid && this.loc.getWeekendDays().includes(this.weekday);
|
|
8384
|
+
}
|
|
8385
|
+
|
|
8386
|
+
/**
|
|
8387
|
+
* Get the day of the week according to the locale.
|
|
8388
|
+
* 1 is the first day of the week and 7 is the last day of the week.
|
|
8389
|
+
* If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1,
|
|
8390
|
+
* @returns {number}
|
|
8391
|
+
*/
|
|
8392
|
+
}, {
|
|
8393
|
+
key: "localWeekday",
|
|
8394
|
+
get: function get() {
|
|
8395
|
+
return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN;
|
|
8396
|
+
}
|
|
8397
|
+
|
|
8398
|
+
/**
|
|
8399
|
+
* Get the week number of the week year according to the locale. Different locales assign week numbers differently,
|
|
8400
|
+
* because the week can start on different days of the week (see localWeekday) and because a different number of days
|
|
8401
|
+
* is required for a week to count as the first week of a year.
|
|
8402
|
+
* @returns {number}
|
|
8403
|
+
*/
|
|
8404
|
+
}, {
|
|
8405
|
+
key: "localWeekNumber",
|
|
8406
|
+
get: function get() {
|
|
8407
|
+
return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN;
|
|
8408
|
+
}
|
|
8409
|
+
|
|
8410
|
+
/**
|
|
8411
|
+
* Get the week year according to the locale. Different locales assign week numbers (and therefor week years)
|
|
8412
|
+
* differently, see localWeekNumber.
|
|
8413
|
+
* @returns {number}
|
|
8414
|
+
*/
|
|
8415
|
+
}, {
|
|
8416
|
+
key: "localWeekYear",
|
|
8417
|
+
get: function get() {
|
|
8418
|
+
return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN;
|
|
8419
|
+
}
|
|
8420
|
+
|
|
7941
8421
|
/**
|
|
7942
8422
|
* Get the ordinal (meaning the day of the year)
|
|
7943
8423
|
* @example DateTime.local(2017, 5, 25).ordinal //=> 145
|
|
@@ -8081,13 +8561,6 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
8081
8561
|
}).offset;
|
|
8082
8562
|
}
|
|
8083
8563
|
}
|
|
8084
|
-
|
|
8085
|
-
/**
|
|
8086
|
-
* Returns true if this DateTime is in a leap year, false otherwise
|
|
8087
|
-
* @example DateTime.local(2016).isInLeapYear //=> true
|
|
8088
|
-
* @example DateTime.local(2013).isInLeapYear //=> false
|
|
8089
|
-
* @type {boolean}
|
|
8090
|
-
*/
|
|
8091
8564
|
}, {
|
|
8092
8565
|
key: "isInLeapYear",
|
|
8093
8566
|
get: function get() {
|
|
@@ -8130,6 +8603,18 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
8130
8603
|
get: function get() {
|
|
8131
8604
|
return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;
|
|
8132
8605
|
}
|
|
8606
|
+
|
|
8607
|
+
/**
|
|
8608
|
+
* Returns the number of weeks in this DateTime's local week year
|
|
8609
|
+
* @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52
|
|
8610
|
+
* @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53
|
|
8611
|
+
* @type {number}
|
|
8612
|
+
*/
|
|
8613
|
+
}, {
|
|
8614
|
+
key: "weeksInLocalWeekYear",
|
|
8615
|
+
get: function get() {
|
|
8616
|
+
return this.isValid ? weeksInWeekYear(this.localWeekYear, this.loc.getMinDaysInFirstWeek(), this.loc.getStartOfWeek()) : NaN;
|
|
8617
|
+
}
|
|
8133
8618
|
}], [{
|
|
8134
8619
|
key: "DATE_SHORT",
|
|
8135
8620
|
get: function get() {
|
|
@@ -8347,7 +8832,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
8347
8832
|
}
|
|
8348
8833
|
}]);
|
|
8349
8834
|
return DateTime;
|
|
8350
|
-
}();
|
|
8835
|
+
}(Symbol.for("nodejs.util.inspect.custom"));
|
|
8351
8836
|
function friendlyDateTime(dateTimeish) {
|
|
8352
8837
|
if (DateTime.isDateTime(dateTimeish)) {
|
|
8353
8838
|
return dateTimeish;
|
|
@@ -8360,7 +8845,7 @@ function friendlyDateTime(dateTimeish) {
|
|
|
8360
8845
|
}
|
|
8361
8846
|
}
|
|
8362
8847
|
|
|
8363
|
-
var VERSION = "3.
|
|
8848
|
+
var VERSION = "3.4.4";
|
|
8364
8849
|
|
|
8365
8850
|
exports.DateTime = DateTime;
|
|
8366
8851
|
exports.Duration = Duration;
|