@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
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const kupManager$1 = require('./kup-manager-
|
|
5
|
+
const index = require('./index-d8e5eb5f.js');
|
|
6
|
+
const kupManager$1 = require('./kup-manager-7334c396.js');
|
|
7
7
|
const GenericVariables = require('./GenericVariables-1d52ba57.js');
|
|
8
|
-
const fTextField = require('./f-text-field-
|
|
8
|
+
const fTextField = require('./f-text-field-c74856ff.js');
|
|
9
9
|
const fTextFieldMdc = require('./f-text-field-mdc-4fda9705.js');
|
|
10
10
|
require('./component-cb3b32f5.js');
|
|
11
11
|
|
|
@@ -1420,6 +1420,17 @@ function systemLocale() {
|
|
|
1420
1420
|
return sysLocaleCache;
|
|
1421
1421
|
}
|
|
1422
1422
|
}
|
|
1423
|
+
var weekInfoCache = {};
|
|
1424
|
+
function getCachedWeekInfo(locString) {
|
|
1425
|
+
var data = weekInfoCache[locString];
|
|
1426
|
+
if (!data) {
|
|
1427
|
+
var locale = new Intl.Locale(locString);
|
|
1428
|
+
// browsers currently implement this as a property, but spec says it should be a getter function
|
|
1429
|
+
data = "getWeekInfo" in locale ? locale.getWeekInfo() : locale.weekInfo;
|
|
1430
|
+
weekInfoCache[locString] = data;
|
|
1431
|
+
}
|
|
1432
|
+
return data;
|
|
1433
|
+
}
|
|
1423
1434
|
function parseLocaleString(localeStr) {
|
|
1424
1435
|
// I really want to avoid writing a BCP 47 parser
|
|
1425
1436
|
// see, e.g. https://github.com/wooorm/bcp-47
|
|
@@ -1475,7 +1486,7 @@ function intlConfigString(localeStr, numberingSystem, outputCalendar) {
|
|
|
1475
1486
|
function mapMonths(f) {
|
|
1476
1487
|
var ms = [];
|
|
1477
1488
|
for (var i = 1; i <= 12; i++) {
|
|
1478
|
-
var dt = DateTime.utc(
|
|
1489
|
+
var dt = DateTime.utc(2009, i, 1);
|
|
1479
1490
|
ms.push(f(dt));
|
|
1480
1491
|
}
|
|
1481
1492
|
return ms;
|
|
@@ -1488,8 +1499,8 @@ function mapWeekdays(f) {
|
|
|
1488
1499
|
}
|
|
1489
1500
|
return ms;
|
|
1490
1501
|
}
|
|
1491
|
-
function listStuff(loc, length,
|
|
1492
|
-
var mode = loc.listingMode(
|
|
1502
|
+
function listStuff(loc, length, englishFn, intlFn) {
|
|
1503
|
+
var mode = loc.listingMode();
|
|
1493
1504
|
if (mode === "error") {
|
|
1494
1505
|
return null;
|
|
1495
1506
|
} else if (mode === "en") {
|
|
@@ -1651,14 +1662,20 @@ var PolyRelFormatter = /*#__PURE__*/function () {
|
|
|
1651
1662
|
};
|
|
1652
1663
|
return PolyRelFormatter;
|
|
1653
1664
|
}();
|
|
1665
|
+
var fallbackWeekSettings = {
|
|
1666
|
+
firstDay: 1,
|
|
1667
|
+
minimalDays: 4,
|
|
1668
|
+
weekend: [6, 7]
|
|
1669
|
+
};
|
|
1670
|
+
|
|
1654
1671
|
/**
|
|
1655
1672
|
* @private
|
|
1656
1673
|
*/
|
|
1657
1674
|
var Locale = /*#__PURE__*/function () {
|
|
1658
1675
|
Locale.fromOpts = function fromOpts(opts) {
|
|
1659
|
-
return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN);
|
|
1676
|
+
return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.weekSettings, opts.defaultToEN);
|
|
1660
1677
|
};
|
|
1661
|
-
Locale.create = function create(locale, numberingSystem, outputCalendar, defaultToEN) {
|
|
1678
|
+
Locale.create = function create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN) {
|
|
1662
1679
|
if (defaultToEN === void 0) {
|
|
1663
1680
|
defaultToEN = false;
|
|
1664
1681
|
}
|
|
@@ -1667,7 +1684,8 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1667
1684
|
var localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale());
|
|
1668
1685
|
var numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;
|
|
1669
1686
|
var outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
|
|
1670
|
-
|
|
1687
|
+
var weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings;
|
|
1688
|
+
return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale);
|
|
1671
1689
|
};
|
|
1672
1690
|
Locale.resetCache = function resetCache() {
|
|
1673
1691
|
sysLocaleCache = null;
|
|
@@ -1679,10 +1697,11 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1679
1697
|
var _ref2 = _temp === void 0 ? {} : _temp,
|
|
1680
1698
|
locale = _ref2.locale,
|
|
1681
1699
|
numberingSystem = _ref2.numberingSystem,
|
|
1682
|
-
outputCalendar = _ref2.outputCalendar
|
|
1683
|
-
|
|
1700
|
+
outputCalendar = _ref2.outputCalendar,
|
|
1701
|
+
weekSettings = _ref2.weekSettings;
|
|
1702
|
+
return Locale.create(locale, numberingSystem, outputCalendar, weekSettings);
|
|
1684
1703
|
};
|
|
1685
|
-
function Locale(locale, numbering, outputCalendar, specifiedLocale) {
|
|
1704
|
+
function Locale(locale, numbering, outputCalendar, weekSettings, specifiedLocale) {
|
|
1686
1705
|
var _parseLocaleString = parseLocaleString(locale),
|
|
1687
1706
|
parsedLocale = _parseLocaleString[0],
|
|
1688
1707
|
parsedNumberingSystem = _parseLocaleString[1],
|
|
@@ -1690,6 +1709,7 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1690
1709
|
this.locale = parsedLocale;
|
|
1691
1710
|
this.numberingSystem = numbering || parsedNumberingSystem || null;
|
|
1692
1711
|
this.outputCalendar = outputCalendar || parsedOutputCalendar || null;
|
|
1712
|
+
this.weekSettings = weekSettings;
|
|
1693
1713
|
this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);
|
|
1694
1714
|
this.weekdaysCache = {
|
|
1695
1715
|
format: {},
|
|
@@ -1714,7 +1734,7 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1714
1734
|
if (!alts || Object.getOwnPropertyNames(alts).length === 0) {
|
|
1715
1735
|
return this;
|
|
1716
1736
|
} else {
|
|
1717
|
-
return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, alts.defaultToEN || false);
|
|
1737
|
+
return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, validateWeekSettings(alts.weekSettings) || this.weekSettings, alts.defaultToEN || false);
|
|
1718
1738
|
}
|
|
1719
1739
|
};
|
|
1720
1740
|
_proto4.redefaultToEN = function redefaultToEN(alts) {
|
|
@@ -1733,15 +1753,12 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1733
1753
|
defaultToEN: false
|
|
1734
1754
|
}));
|
|
1735
1755
|
};
|
|
1736
|
-
_proto4.months = function months$1(length, format
|
|
1756
|
+
_proto4.months = function months$1(length, format) {
|
|
1737
1757
|
var _this2 = this;
|
|
1738
1758
|
if (format === void 0) {
|
|
1739
1759
|
format = false;
|
|
1740
1760
|
}
|
|
1741
|
-
|
|
1742
|
-
defaultOK = true;
|
|
1743
|
-
}
|
|
1744
|
-
return listStuff(this, length, defaultOK, months, function () {
|
|
1761
|
+
return listStuff(this, length, months, function () {
|
|
1745
1762
|
var intl = format ? {
|
|
1746
1763
|
month: length,
|
|
1747
1764
|
day: "numeric"
|
|
@@ -1757,15 +1774,12 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1757
1774
|
return _this2.monthsCache[formatStr][length];
|
|
1758
1775
|
});
|
|
1759
1776
|
};
|
|
1760
|
-
_proto4.weekdays = function weekdays$1(length, format
|
|
1777
|
+
_proto4.weekdays = function weekdays$1(length, format) {
|
|
1761
1778
|
var _this3 = this;
|
|
1762
1779
|
if (format === void 0) {
|
|
1763
1780
|
format = false;
|
|
1764
1781
|
}
|
|
1765
|
-
|
|
1766
|
-
defaultOK = true;
|
|
1767
|
-
}
|
|
1768
|
-
return listStuff(this, length, defaultOK, weekdays, function () {
|
|
1782
|
+
return listStuff(this, length, weekdays, function () {
|
|
1769
1783
|
var intl = format ? {
|
|
1770
1784
|
weekday: length,
|
|
1771
1785
|
year: "numeric",
|
|
@@ -1783,12 +1797,9 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1783
1797
|
return _this3.weekdaysCache[formatStr][length];
|
|
1784
1798
|
});
|
|
1785
1799
|
};
|
|
1786
|
-
_proto4.meridiems = function meridiems$1(
|
|
1800
|
+
_proto4.meridiems = function meridiems$1() {
|
|
1787
1801
|
var _this4 = this;
|
|
1788
|
-
|
|
1789
|
-
defaultOK = true;
|
|
1790
|
-
}
|
|
1791
|
-
return listStuff(this, undefined, defaultOK, function () {
|
|
1802
|
+
return listStuff(this, undefined, function () {
|
|
1792
1803
|
return meridiems;
|
|
1793
1804
|
}, function () {
|
|
1794
1805
|
// In theory there could be aribitrary day periods. We're gonna assume there are exactly two
|
|
@@ -1805,12 +1816,9 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1805
1816
|
return _this4.meridiemCache;
|
|
1806
1817
|
});
|
|
1807
1818
|
};
|
|
1808
|
-
_proto4.eras = function eras$1(length
|
|
1819
|
+
_proto4.eras = function eras$1(length) {
|
|
1809
1820
|
var _this5 = this;
|
|
1810
|
-
|
|
1811
|
-
defaultOK = true;
|
|
1812
|
-
}
|
|
1813
|
-
return listStuff(this, length, defaultOK, eras, function () {
|
|
1821
|
+
return listStuff(this, length, eras, function () {
|
|
1814
1822
|
var intl = {
|
|
1815
1823
|
era: length
|
|
1816
1824
|
};
|
|
@@ -1862,6 +1870,24 @@ var Locale = /*#__PURE__*/function () {
|
|
|
1862
1870
|
_proto4.isEnglish = function isEnglish() {
|
|
1863
1871
|
return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us");
|
|
1864
1872
|
};
|
|
1873
|
+
_proto4.getWeekSettings = function getWeekSettings() {
|
|
1874
|
+
if (this.weekSettings) {
|
|
1875
|
+
return this.weekSettings;
|
|
1876
|
+
} else if (!hasLocaleWeekInfo()) {
|
|
1877
|
+
return fallbackWeekSettings;
|
|
1878
|
+
} else {
|
|
1879
|
+
return getCachedWeekInfo(this.locale);
|
|
1880
|
+
}
|
|
1881
|
+
};
|
|
1882
|
+
_proto4.getStartOfWeek = function getStartOfWeek() {
|
|
1883
|
+
return this.getWeekSettings().firstDay;
|
|
1884
|
+
};
|
|
1885
|
+
_proto4.getMinDaysInFirstWeek = function getMinDaysInFirstWeek() {
|
|
1886
|
+
return this.getWeekSettings().minimalDays;
|
|
1887
|
+
};
|
|
1888
|
+
_proto4.getWeekendDays = function getWeekendDays() {
|
|
1889
|
+
return this.getWeekSettings().weekend;
|
|
1890
|
+
};
|
|
1865
1891
|
_proto4.equals = function equals(other) {
|
|
1866
1892
|
return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar;
|
|
1867
1893
|
};
|
|
@@ -2069,7 +2095,7 @@ function normalizeZone(input, defaultZone) {
|
|
|
2069
2095
|
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);
|
|
2070
2096
|
} else if (isNumber(input)) {
|
|
2071
2097
|
return FixedOffsetZone.instance(input);
|
|
2072
|
-
} else if (typeof input === "object" &&
|
|
2098
|
+
} else if (typeof input === "object" && "offset" in input && typeof input.offset === "function") {
|
|
2073
2099
|
// This is dumb, but the instanceof check above doesn't seem to really work
|
|
2074
2100
|
// so we're duck checking it
|
|
2075
2101
|
return input;
|
|
@@ -2086,7 +2112,8 @@ var now = function now() {
|
|
|
2086
2112
|
defaultNumberingSystem = null,
|
|
2087
2113
|
defaultOutputCalendar = null,
|
|
2088
2114
|
twoDigitCutoffYear = 60,
|
|
2089
|
-
throwOnInvalid
|
|
2115
|
+
throwOnInvalid,
|
|
2116
|
+
defaultWeekSettings = null;
|
|
2090
2117
|
|
|
2091
2118
|
/**
|
|
2092
2119
|
* 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.
|
|
@@ -2197,6 +2224,33 @@ var Settings = /*#__PURE__*/function () {
|
|
|
2197
2224
|
defaultOutputCalendar = outputCalendar;
|
|
2198
2225
|
}
|
|
2199
2226
|
|
|
2227
|
+
/**
|
|
2228
|
+
* @typedef {Object} WeekSettings
|
|
2229
|
+
* @property {number} firstDay
|
|
2230
|
+
* @property {number} minimalDays
|
|
2231
|
+
* @property {number[]} weekend
|
|
2232
|
+
*/
|
|
2233
|
+
|
|
2234
|
+
/**
|
|
2235
|
+
* @return {WeekSettings|null}
|
|
2236
|
+
*/
|
|
2237
|
+
}, {
|
|
2238
|
+
key: "defaultWeekSettings",
|
|
2239
|
+
get: function get() {
|
|
2240
|
+
return defaultWeekSettings;
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
/**
|
|
2244
|
+
* Allows overriding the default locale week settings, i.e. the start of the week, the weekend and
|
|
2245
|
+
* how many days are required in the first week of a year.
|
|
2246
|
+
* Does not affect existing instances.
|
|
2247
|
+
*
|
|
2248
|
+
* @param {WeekSettings|null} weekSettings
|
|
2249
|
+
*/,
|
|
2250
|
+
set: function set(weekSettings) {
|
|
2251
|
+
defaultWeekSettings = validateWeekSettings(weekSettings);
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2200
2254
|
/**
|
|
2201
2255
|
* Get the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century.
|
|
2202
2256
|
* @type {number}
|
|
@@ -2210,10 +2264,10 @@ var Settings = /*#__PURE__*/function () {
|
|
|
2210
2264
|
/**
|
|
2211
2265
|
* Set the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century.
|
|
2212
2266
|
* @type {number}
|
|
2213
|
-
* @example Settings.twoDigitCutoffYear = 0 // cut-off year is 0, so all 'yy' are
|
|
2267
|
+
* @example Settings.twoDigitCutoffYear = 0 // cut-off year is 0, so all 'yy' are interpreted as current century
|
|
2214
2268
|
* @example Settings.twoDigitCutoffYear = 50 // '49' -> 1949; '50' -> 2050
|
|
2215
|
-
* @example Settings.twoDigitCutoffYear = 1950 //
|
|
2216
|
-
* @example Settings.twoDigitCutoffYear = 2050 // ALSO
|
|
2269
|
+
* @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50
|
|
2270
|
+
* @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50
|
|
2217
2271
|
*/,
|
|
2218
2272
|
set: function set(cutoffYear) {
|
|
2219
2273
|
twoDigitCutoffYear = cutoffYear % 100;
|
|
@@ -2240,6 +2294,230 @@ var Settings = /*#__PURE__*/function () {
|
|
|
2240
2294
|
return Settings;
|
|
2241
2295
|
}();
|
|
2242
2296
|
|
|
2297
|
+
var Invalid = /*#__PURE__*/function () {
|
|
2298
|
+
function Invalid(reason, explanation) {
|
|
2299
|
+
this.reason = reason;
|
|
2300
|
+
this.explanation = explanation;
|
|
2301
|
+
}
|
|
2302
|
+
var _proto = Invalid.prototype;
|
|
2303
|
+
_proto.toMessage = function toMessage() {
|
|
2304
|
+
if (this.explanation) {
|
|
2305
|
+
return this.reason + ": " + this.explanation;
|
|
2306
|
+
} else {
|
|
2307
|
+
return this.reason;
|
|
2308
|
+
}
|
|
2309
|
+
};
|
|
2310
|
+
return Invalid;
|
|
2311
|
+
}();
|
|
2312
|
+
|
|
2313
|
+
var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
|
|
2314
|
+
leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
|
|
2315
|
+
function unitOutOfRange(unit, value) {
|
|
2316
|
+
return new Invalid("unit out of range", "you specified " + value + " (of type " + typeof value + ") as a " + unit + ", which is invalid");
|
|
2317
|
+
}
|
|
2318
|
+
function dayOfWeek(year, month, day) {
|
|
2319
|
+
var d = new Date(Date.UTC(year, month - 1, day));
|
|
2320
|
+
if (year < 100 && year >= 0) {
|
|
2321
|
+
d.setUTCFullYear(d.getUTCFullYear() - 1900);
|
|
2322
|
+
}
|
|
2323
|
+
var js = d.getUTCDay();
|
|
2324
|
+
return js === 0 ? 7 : js;
|
|
2325
|
+
}
|
|
2326
|
+
function computeOrdinal(year, month, day) {
|
|
2327
|
+
return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
|
|
2328
|
+
}
|
|
2329
|
+
function uncomputeOrdinal(year, ordinal) {
|
|
2330
|
+
var table = isLeapYear(year) ? leapLadder : nonLeapLadder,
|
|
2331
|
+
month0 = table.findIndex(function (i) {
|
|
2332
|
+
return i < ordinal;
|
|
2333
|
+
}),
|
|
2334
|
+
day = ordinal - table[month0];
|
|
2335
|
+
return {
|
|
2336
|
+
month: month0 + 1,
|
|
2337
|
+
day: day
|
|
2338
|
+
};
|
|
2339
|
+
}
|
|
2340
|
+
function isoWeekdayToLocal(isoWeekday, startOfWeek) {
|
|
2341
|
+
return (isoWeekday - startOfWeek + 7) % 7 + 1;
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
/**
|
|
2345
|
+
* @private
|
|
2346
|
+
*/
|
|
2347
|
+
|
|
2348
|
+
function gregorianToWeek(gregObj, minDaysInFirstWeek, startOfWeek) {
|
|
2349
|
+
if (minDaysInFirstWeek === void 0) {
|
|
2350
|
+
minDaysInFirstWeek = 4;
|
|
2351
|
+
}
|
|
2352
|
+
if (startOfWeek === void 0) {
|
|
2353
|
+
startOfWeek = 1;
|
|
2354
|
+
}
|
|
2355
|
+
var year = gregObj.year,
|
|
2356
|
+
month = gregObj.month,
|
|
2357
|
+
day = gregObj.day,
|
|
2358
|
+
ordinal = computeOrdinal(year, month, day),
|
|
2359
|
+
weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek);
|
|
2360
|
+
var weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7),
|
|
2361
|
+
weekYear;
|
|
2362
|
+
if (weekNumber < 1) {
|
|
2363
|
+
weekYear = year - 1;
|
|
2364
|
+
weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek);
|
|
2365
|
+
} else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) {
|
|
2366
|
+
weekYear = year + 1;
|
|
2367
|
+
weekNumber = 1;
|
|
2368
|
+
} else {
|
|
2369
|
+
weekYear = year;
|
|
2370
|
+
}
|
|
2371
|
+
return _extends({
|
|
2372
|
+
weekYear: weekYear,
|
|
2373
|
+
weekNumber: weekNumber,
|
|
2374
|
+
weekday: weekday
|
|
2375
|
+
}, timeObject(gregObj));
|
|
2376
|
+
}
|
|
2377
|
+
function weekToGregorian(weekData, minDaysInFirstWeek, startOfWeek) {
|
|
2378
|
+
if (minDaysInFirstWeek === void 0) {
|
|
2379
|
+
minDaysInFirstWeek = 4;
|
|
2380
|
+
}
|
|
2381
|
+
if (startOfWeek === void 0) {
|
|
2382
|
+
startOfWeek = 1;
|
|
2383
|
+
}
|
|
2384
|
+
var weekYear = weekData.weekYear,
|
|
2385
|
+
weekNumber = weekData.weekNumber,
|
|
2386
|
+
weekday = weekData.weekday,
|
|
2387
|
+
weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek),
|
|
2388
|
+
yearInDays = daysInYear(weekYear);
|
|
2389
|
+
var ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek,
|
|
2390
|
+
year;
|
|
2391
|
+
if (ordinal < 1) {
|
|
2392
|
+
year = weekYear - 1;
|
|
2393
|
+
ordinal += daysInYear(year);
|
|
2394
|
+
} else if (ordinal > yearInDays) {
|
|
2395
|
+
year = weekYear + 1;
|
|
2396
|
+
ordinal -= daysInYear(weekYear);
|
|
2397
|
+
} else {
|
|
2398
|
+
year = weekYear;
|
|
2399
|
+
}
|
|
2400
|
+
var _uncomputeOrdinal = uncomputeOrdinal(year, ordinal),
|
|
2401
|
+
month = _uncomputeOrdinal.month,
|
|
2402
|
+
day = _uncomputeOrdinal.day;
|
|
2403
|
+
return _extends({
|
|
2404
|
+
year: year,
|
|
2405
|
+
month: month,
|
|
2406
|
+
day: day
|
|
2407
|
+
}, timeObject(weekData));
|
|
2408
|
+
}
|
|
2409
|
+
function gregorianToOrdinal(gregData) {
|
|
2410
|
+
var year = gregData.year,
|
|
2411
|
+
month = gregData.month,
|
|
2412
|
+
day = gregData.day;
|
|
2413
|
+
var ordinal = computeOrdinal(year, month, day);
|
|
2414
|
+
return _extends({
|
|
2415
|
+
year: year,
|
|
2416
|
+
ordinal: ordinal
|
|
2417
|
+
}, timeObject(gregData));
|
|
2418
|
+
}
|
|
2419
|
+
function ordinalToGregorian(ordinalData) {
|
|
2420
|
+
var year = ordinalData.year,
|
|
2421
|
+
ordinal = ordinalData.ordinal;
|
|
2422
|
+
var _uncomputeOrdinal2 = uncomputeOrdinal(year, ordinal),
|
|
2423
|
+
month = _uncomputeOrdinal2.month,
|
|
2424
|
+
day = _uncomputeOrdinal2.day;
|
|
2425
|
+
return _extends({
|
|
2426
|
+
year: year,
|
|
2427
|
+
month: month,
|
|
2428
|
+
day: day
|
|
2429
|
+
}, timeObject(ordinalData));
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
/**
|
|
2433
|
+
* Check if local week units like localWeekday are used in obj.
|
|
2434
|
+
* If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties.
|
|
2435
|
+
* Modifies obj in-place!
|
|
2436
|
+
* @param obj the object values
|
|
2437
|
+
*/
|
|
2438
|
+
function usesLocalWeekValues(obj, loc) {
|
|
2439
|
+
var hasLocaleWeekData = !isUndefined(obj.localWeekday) || !isUndefined(obj.localWeekNumber) || !isUndefined(obj.localWeekYear);
|
|
2440
|
+
if (hasLocaleWeekData) {
|
|
2441
|
+
var hasIsoWeekData = !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear);
|
|
2442
|
+
if (hasIsoWeekData) {
|
|
2443
|
+
throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");
|
|
2444
|
+
}
|
|
2445
|
+
if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday;
|
|
2446
|
+
if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber;
|
|
2447
|
+
if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear;
|
|
2448
|
+
delete obj.localWeekday;
|
|
2449
|
+
delete obj.localWeekNumber;
|
|
2450
|
+
delete obj.localWeekYear;
|
|
2451
|
+
return {
|
|
2452
|
+
minDaysInFirstWeek: loc.getMinDaysInFirstWeek(),
|
|
2453
|
+
startOfWeek: loc.getStartOfWeek()
|
|
2454
|
+
};
|
|
2455
|
+
} else {
|
|
2456
|
+
return {
|
|
2457
|
+
minDaysInFirstWeek: 4,
|
|
2458
|
+
startOfWeek: 1
|
|
2459
|
+
};
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
function hasInvalidWeekData(obj, minDaysInFirstWeek, startOfWeek) {
|
|
2463
|
+
if (minDaysInFirstWeek === void 0) {
|
|
2464
|
+
minDaysInFirstWeek = 4;
|
|
2465
|
+
}
|
|
2466
|
+
if (startOfWeek === void 0) {
|
|
2467
|
+
startOfWeek = 1;
|
|
2468
|
+
}
|
|
2469
|
+
var validYear = isInteger(obj.weekYear),
|
|
2470
|
+
validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)),
|
|
2471
|
+
validWeekday = integerBetween(obj.weekday, 1, 7);
|
|
2472
|
+
if (!validYear) {
|
|
2473
|
+
return unitOutOfRange("weekYear", obj.weekYear);
|
|
2474
|
+
} else if (!validWeek) {
|
|
2475
|
+
return unitOutOfRange("week", obj.weekNumber);
|
|
2476
|
+
} else if (!validWeekday) {
|
|
2477
|
+
return unitOutOfRange("weekday", obj.weekday);
|
|
2478
|
+
} else return false;
|
|
2479
|
+
}
|
|
2480
|
+
function hasInvalidOrdinalData(obj) {
|
|
2481
|
+
var validYear = isInteger(obj.year),
|
|
2482
|
+
validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
|
|
2483
|
+
if (!validYear) {
|
|
2484
|
+
return unitOutOfRange("year", obj.year);
|
|
2485
|
+
} else if (!validOrdinal) {
|
|
2486
|
+
return unitOutOfRange("ordinal", obj.ordinal);
|
|
2487
|
+
} else return false;
|
|
2488
|
+
}
|
|
2489
|
+
function hasInvalidGregorianData(obj) {
|
|
2490
|
+
var validYear = isInteger(obj.year),
|
|
2491
|
+
validMonth = integerBetween(obj.month, 1, 12),
|
|
2492
|
+
validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
|
|
2493
|
+
if (!validYear) {
|
|
2494
|
+
return unitOutOfRange("year", obj.year);
|
|
2495
|
+
} else if (!validMonth) {
|
|
2496
|
+
return unitOutOfRange("month", obj.month);
|
|
2497
|
+
} else if (!validDay) {
|
|
2498
|
+
return unitOutOfRange("day", obj.day);
|
|
2499
|
+
} else return false;
|
|
2500
|
+
}
|
|
2501
|
+
function hasInvalidTimeData(obj) {
|
|
2502
|
+
var hour = obj.hour,
|
|
2503
|
+
minute = obj.minute,
|
|
2504
|
+
second = obj.second,
|
|
2505
|
+
millisecond = obj.millisecond;
|
|
2506
|
+
var validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0,
|
|
2507
|
+
validMinute = integerBetween(minute, 0, 59),
|
|
2508
|
+
validSecond = integerBetween(second, 0, 59),
|
|
2509
|
+
validMillisecond = integerBetween(millisecond, 0, 999);
|
|
2510
|
+
if (!validHour) {
|
|
2511
|
+
return unitOutOfRange("hour", hour);
|
|
2512
|
+
} else if (!validMinute) {
|
|
2513
|
+
return unitOutOfRange("minute", minute);
|
|
2514
|
+
} else if (!validSecond) {
|
|
2515
|
+
return unitOutOfRange("second", second);
|
|
2516
|
+
} else if (!validMillisecond) {
|
|
2517
|
+
return unitOutOfRange("millisecond", millisecond);
|
|
2518
|
+
} else return false;
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2243
2521
|
/**
|
|
2244
2522
|
* @private
|
|
2245
2523
|
*/
|
|
@@ -2271,6 +2549,13 @@ function hasRelative() {
|
|
|
2271
2549
|
return false;
|
|
2272
2550
|
}
|
|
2273
2551
|
}
|
|
2552
|
+
function hasLocaleWeekInfo() {
|
|
2553
|
+
try {
|
|
2554
|
+
return typeof Intl !== "undefined" && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype);
|
|
2555
|
+
} catch (e) {
|
|
2556
|
+
return false;
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2274
2559
|
|
|
2275
2560
|
// OBJECTS AND ARRAYS
|
|
2276
2561
|
|
|
@@ -2301,6 +2586,24 @@ function pick(obj, keys) {
|
|
|
2301
2586
|
function hasOwnProperty(obj, prop) {
|
|
2302
2587
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
2303
2588
|
}
|
|
2589
|
+
function validateWeekSettings(settings) {
|
|
2590
|
+
if (settings == null) {
|
|
2591
|
+
return null;
|
|
2592
|
+
} else if (typeof settings !== "object") {
|
|
2593
|
+
throw new InvalidArgumentError("Week settings must be an object");
|
|
2594
|
+
} else {
|
|
2595
|
+
if (!integerBetween(settings.firstDay, 1, 7) || !integerBetween(settings.minimalDays, 1, 7) || !Array.isArray(settings.weekend) || settings.weekend.some(function (v) {
|
|
2596
|
+
return !integerBetween(v, 1, 7);
|
|
2597
|
+
})) {
|
|
2598
|
+
throw new InvalidArgumentError("Invalid week settings");
|
|
2599
|
+
}
|
|
2600
|
+
return {
|
|
2601
|
+
firstDay: settings.firstDay,
|
|
2602
|
+
minimalDays: settings.minimalDays,
|
|
2603
|
+
weekend: Array.from(settings.weekend)
|
|
2604
|
+
};
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2304
2607
|
|
|
2305
2608
|
// NUMBERS AND STRINGS
|
|
2306
2609
|
|
|
@@ -2375,7 +2678,7 @@ function daysInMonth(year, month) {
|
|
|
2375
2678
|
}
|
|
2376
2679
|
}
|
|
2377
2680
|
|
|
2378
|
-
//
|
|
2681
|
+
// convert a calendar object to a local timestamp (epoch, but with the offset baked in)
|
|
2379
2682
|
function objToLocalTS(obj) {
|
|
2380
2683
|
var d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond);
|
|
2381
2684
|
|
|
@@ -2389,11 +2692,22 @@ function objToLocalTS(obj) {
|
|
|
2389
2692
|
}
|
|
2390
2693
|
return +d;
|
|
2391
2694
|
}
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
return
|
|
2695
|
+
|
|
2696
|
+
// adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js
|
|
2697
|
+
function firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) {
|
|
2698
|
+
var fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek);
|
|
2699
|
+
return -fwdlw + minDaysInFirstWeek - 1;
|
|
2700
|
+
}
|
|
2701
|
+
function weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek) {
|
|
2702
|
+
if (minDaysInFirstWeek === void 0) {
|
|
2703
|
+
minDaysInFirstWeek = 4;
|
|
2704
|
+
}
|
|
2705
|
+
if (startOfWeek === void 0) {
|
|
2706
|
+
startOfWeek = 1;
|
|
2707
|
+
}
|
|
2708
|
+
var weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek);
|
|
2709
|
+
var weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek);
|
|
2710
|
+
return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7;
|
|
2397
2711
|
}
|
|
2398
2712
|
function untruncateYear(year) {
|
|
2399
2713
|
if (year > 99) {
|
|
@@ -2688,33 +3002,24 @@ var Formatter = /*#__PURE__*/function () {
|
|
|
2688
3002
|
var df = this.systemLoc.dtFormatter(dt, _extends({}, this.opts, opts));
|
|
2689
3003
|
return df.format();
|
|
2690
3004
|
};
|
|
2691
|
-
_proto.
|
|
3005
|
+
_proto.dtFormatter = function dtFormatter(dt, opts) {
|
|
2692
3006
|
if (opts === void 0) {
|
|
2693
3007
|
opts = {};
|
|
2694
3008
|
}
|
|
2695
|
-
|
|
2696
|
-
|
|
3009
|
+
return this.loc.dtFormatter(dt, _extends({}, this.opts, opts));
|
|
3010
|
+
};
|
|
3011
|
+
_proto.formatDateTime = function formatDateTime(dt, opts) {
|
|
3012
|
+
return this.dtFormatter(dt, opts).format();
|
|
2697
3013
|
};
|
|
2698
3014
|
_proto.formatDateTimeParts = function formatDateTimeParts(dt, opts) {
|
|
2699
|
-
|
|
2700
|
-
opts = {};
|
|
2701
|
-
}
|
|
2702
|
-
var df = this.loc.dtFormatter(dt, _extends({}, this.opts, opts));
|
|
2703
|
-
return df.formatToParts();
|
|
3015
|
+
return this.dtFormatter(dt, opts).formatToParts();
|
|
2704
3016
|
};
|
|
2705
3017
|
_proto.formatInterval = function formatInterval(interval, opts) {
|
|
2706
|
-
|
|
2707
|
-
opts = {};
|
|
2708
|
-
}
|
|
2709
|
-
var df = this.loc.dtFormatter(interval.start, _extends({}, this.opts, opts));
|
|
3018
|
+
var df = this.dtFormatter(interval.start, opts);
|
|
2710
3019
|
return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate());
|
|
2711
3020
|
};
|
|
2712
3021
|
_proto.resolvedOptions = function resolvedOptions(dt, opts) {
|
|
2713
|
-
|
|
2714
|
-
opts = {};
|
|
2715
|
-
}
|
|
2716
|
-
var df = this.loc.dtFormatter(dt, _extends({}, this.opts, opts));
|
|
2717
|
-
return df.resolvedOptions();
|
|
3022
|
+
return this.dtFormatter(dt, opts).resolvedOptions();
|
|
2718
3023
|
};
|
|
2719
3024
|
_proto.num = function num(n, p) {
|
|
2720
3025
|
if (p === void 0) {
|
|
@@ -2780,7 +3085,7 @@ var Formatter = /*#__PURE__*/function () {
|
|
|
2780
3085
|
}, "era");
|
|
2781
3086
|
},
|
|
2782
3087
|
tokenToString = function tokenToString(token) {
|
|
2783
|
-
// Where possible:
|
|
3088
|
+
// Where possible: https://cldr.unicode.org/translation/date-time/date-time-symbols
|
|
2784
3089
|
switch (token) {
|
|
2785
3090
|
// ms
|
|
2786
3091
|
case "S":
|
|
@@ -2966,6 +3271,14 @@ var Formatter = /*#__PURE__*/function () {
|
|
|
2966
3271
|
return _this.num(dt.weekNumber);
|
|
2967
3272
|
case "WW":
|
|
2968
3273
|
return _this.num(dt.weekNumber, 2);
|
|
3274
|
+
case "n":
|
|
3275
|
+
return _this.num(dt.localWeekNumber);
|
|
3276
|
+
case "nn":
|
|
3277
|
+
return _this.num(dt.localWeekNumber, 2);
|
|
3278
|
+
case "ii":
|
|
3279
|
+
return _this.num(dt.localWeekYear.toString().slice(-2), 2);
|
|
3280
|
+
case "iiii":
|
|
3281
|
+
return _this.num(dt.localWeekYear, 4);
|
|
2969
3282
|
case "o":
|
|
2970
3283
|
return _this.num(dt.ordinal);
|
|
2971
3284
|
case "ooo":
|
|
@@ -3034,22 +3347,6 @@ var Formatter = /*#__PURE__*/function () {
|
|
|
3034
3347
|
return Formatter;
|
|
3035
3348
|
}();
|
|
3036
3349
|
|
|
3037
|
-
var Invalid = /*#__PURE__*/function () {
|
|
3038
|
-
function Invalid(reason, explanation) {
|
|
3039
|
-
this.reason = reason;
|
|
3040
|
-
this.explanation = explanation;
|
|
3041
|
-
}
|
|
3042
|
-
var _proto = Invalid.prototype;
|
|
3043
|
-
_proto.toMessage = function toMessage() {
|
|
3044
|
-
if (this.explanation) {
|
|
3045
|
-
return this.reason + ": " + this.explanation;
|
|
3046
|
-
} else {
|
|
3047
|
-
return this.reason;
|
|
3048
|
-
}
|
|
3049
|
-
};
|
|
3050
|
-
return Invalid;
|
|
3051
|
-
}();
|
|
3052
|
-
|
|
3053
3350
|
/*
|
|
3054
3351
|
* This file handles parsing for well-specified formats. Here's how it works:
|
|
3055
3352
|
* Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.
|
|
@@ -3433,27 +3730,62 @@ function clone$1(dur, alts, clear) {
|
|
|
3433
3730
|
};
|
|
3434
3731
|
return new Duration(conf);
|
|
3435
3732
|
}
|
|
3436
|
-
function
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
added = !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw);
|
|
3447
|
-
toMap[toUnit] += added;
|
|
3448
|
-
fromMap[fromUnit] -= added * conv;
|
|
3733
|
+
function durationToMillis(matrix, vals) {
|
|
3734
|
+
var _vals$milliseconds;
|
|
3735
|
+
var sum = (_vals$milliseconds = vals.milliseconds) != null ? _vals$milliseconds : 0;
|
|
3736
|
+
for (var _iterator = _createForOfIteratorHelperLoose(reverseUnits.slice(1)), _step; !(_step = _iterator()).done;) {
|
|
3737
|
+
var unit = _step.value;
|
|
3738
|
+
if (vals[unit]) {
|
|
3739
|
+
sum += vals[unit] * matrix[unit]["milliseconds"];
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
return sum;
|
|
3449
3743
|
}
|
|
3450
3744
|
|
|
3451
3745
|
// NB: mutates parameters
|
|
3452
3746
|
function normalizeValues(matrix, vals) {
|
|
3453
|
-
|
|
3747
|
+
// the logic below assumes the overall value of the duration is positive
|
|
3748
|
+
// if this is not the case, factor is used to make it so
|
|
3749
|
+
var factor = durationToMillis(matrix, vals) < 0 ? -1 : 1;
|
|
3750
|
+
orderedUnits$1.reduceRight(function (previous, current) {
|
|
3454
3751
|
if (!isUndefined(vals[current])) {
|
|
3455
3752
|
if (previous) {
|
|
3456
|
-
|
|
3753
|
+
var previousVal = vals[previous] * factor;
|
|
3754
|
+
var conv = matrix[current][previous];
|
|
3755
|
+
|
|
3756
|
+
// if (previousVal < 0):
|
|
3757
|
+
// lower order unit is negative (e.g. { years: 2, days: -2 })
|
|
3758
|
+
// normalize this by reducing the higher order unit by the appropriate amount
|
|
3759
|
+
// and increasing the lower order unit
|
|
3760
|
+
// this can never make the higher order unit negative, because this function only operates
|
|
3761
|
+
// on positive durations, so the amount of time represented by the lower order unit cannot
|
|
3762
|
+
// be larger than the higher order unit
|
|
3763
|
+
// else:
|
|
3764
|
+
// lower order unit is positive (e.g. { years: 2, days: 450 } or { years: -2, days: 450 })
|
|
3765
|
+
// in this case we attempt to convert as much as possible from the lower order unit into
|
|
3766
|
+
// the higher order one
|
|
3767
|
+
//
|
|
3768
|
+
// Math.floor takes care of both of these cases, rounding away from 0
|
|
3769
|
+
// if previousVal < 0 it makes the absolute value larger
|
|
3770
|
+
// if previousVal >= it makes the absolute value smaller
|
|
3771
|
+
var rollUp = Math.floor(previousVal / conv);
|
|
3772
|
+
vals[current] += rollUp * factor;
|
|
3773
|
+
vals[previous] -= rollUp * conv * factor;
|
|
3774
|
+
}
|
|
3775
|
+
return current;
|
|
3776
|
+
} else {
|
|
3777
|
+
return previous;
|
|
3778
|
+
}
|
|
3779
|
+
}, null);
|
|
3780
|
+
|
|
3781
|
+
// try to convert any decimals into smaller units if possible
|
|
3782
|
+
// for example for { years: 2.5, days: 0, seconds: 0 } we want to get { years: 2, days: 182, hours: 12 }
|
|
3783
|
+
orderedUnits$1.reduce(function (previous, current) {
|
|
3784
|
+
if (!isUndefined(vals[current])) {
|
|
3785
|
+
if (previous) {
|
|
3786
|
+
var fraction = vals[previous] % 1;
|
|
3787
|
+
vals[previous] -= fraction;
|
|
3788
|
+
vals[current] += fraction * matrix[previous][current];
|
|
3457
3789
|
}
|
|
3458
3790
|
return current;
|
|
3459
3791
|
} else {
|
|
@@ -3489,7 +3821,7 @@ function removeZeroes(vals) {
|
|
|
3489
3821
|
*
|
|
3490
3822
|
* There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation.
|
|
3491
3823
|
*/
|
|
3492
|
-
var Duration = /*#__PURE__*/function () {
|
|
3824
|
+
var Duration = /*#__PURE__*/function (_Symbol$for) {
|
|
3493
3825
|
/**
|
|
3494
3826
|
* @private
|
|
3495
3827
|
*/
|
|
@@ -3748,9 +4080,10 @@ var Duration = /*#__PURE__*/function () {
|
|
|
3748
4080
|
|
|
3749
4081
|
/**
|
|
3750
4082
|
* Returns a string representation of a Duration with all units included.
|
|
3751
|
-
* To modify its behavior use
|
|
3752
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
|
|
3753
|
-
* @param opts -
|
|
4083
|
+
* To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.
|
|
4084
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
|
|
4085
|
+
* @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.
|
|
4086
|
+
* @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.
|
|
3754
4087
|
* @example
|
|
3755
4088
|
* ```js
|
|
3756
4089
|
* var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
|
|
@@ -3764,6 +4097,7 @@ var Duration = /*#__PURE__*/function () {
|
|
|
3764
4097
|
if (opts === void 0) {
|
|
3765
4098
|
opts = {};
|
|
3766
4099
|
}
|
|
4100
|
+
if (!this.isValid) return INVALID$2;
|
|
3767
4101
|
var l = orderedUnits$1.map(function (unit) {
|
|
3768
4102
|
var val = _this.values[unit];
|
|
3769
4103
|
if (isUndefined(val)) {
|
|
@@ -3851,20 +4185,13 @@ var Duration = /*#__PURE__*/function () {
|
|
|
3851
4185
|
suppressSeconds: false,
|
|
3852
4186
|
includePrefix: false,
|
|
3853
4187
|
format: "extended"
|
|
3854
|
-
}, opts
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
}
|
|
3862
|
-
}
|
|
3863
|
-
var str = value.toFormat(fmt);
|
|
3864
|
-
if (opts.includePrefix) {
|
|
3865
|
-
str = "T" + str;
|
|
3866
|
-
}
|
|
3867
|
-
return str;
|
|
4188
|
+
}, opts, {
|
|
4189
|
+
includeOffset: false
|
|
4190
|
+
});
|
|
4191
|
+
var dateTime = DateTime.fromMillis(millis, {
|
|
4192
|
+
zone: "UTC"
|
|
4193
|
+
});
|
|
4194
|
+
return dateTime.toISOTime(opts);
|
|
3868
4195
|
}
|
|
3869
4196
|
|
|
3870
4197
|
/**
|
|
@@ -3883,12 +4210,25 @@ var Duration = /*#__PURE__*/function () {
|
|
|
3883
4210
|
return this.toISO();
|
|
3884
4211
|
}
|
|
3885
4212
|
|
|
4213
|
+
/**
|
|
4214
|
+
* Returns a string representation of this Duration appropriate for the REPL.
|
|
4215
|
+
* @return {string}
|
|
4216
|
+
*/;
|
|
4217
|
+
_proto[_Symbol$for] = function () {
|
|
4218
|
+
if (this.isValid) {
|
|
4219
|
+
return "Duration { values: " + JSON.stringify(this.values) + " }";
|
|
4220
|
+
} else {
|
|
4221
|
+
return "Duration { Invalid, reason: " + this.invalidReason + " }";
|
|
4222
|
+
}
|
|
4223
|
+
}
|
|
4224
|
+
|
|
3886
4225
|
/**
|
|
3887
4226
|
* Returns an milliseconds value of this Duration.
|
|
3888
4227
|
* @return {number}
|
|
3889
4228
|
*/;
|
|
3890
4229
|
_proto.toMillis = function toMillis() {
|
|
3891
|
-
|
|
4230
|
+
if (!this.isValid) return NaN;
|
|
4231
|
+
return durationToMillis(this.matrix, this.values);
|
|
3892
4232
|
}
|
|
3893
4233
|
|
|
3894
4234
|
/**
|
|
@@ -4013,8 +4353,17 @@ var Duration = /*#__PURE__*/function () {
|
|
|
4013
4353
|
|
|
4014
4354
|
/**
|
|
4015
4355
|
* Reduce this Duration to its canonical representation in its current units.
|
|
4356
|
+
* Assuming the overall value of the Duration is positive, this means:
|
|
4357
|
+
* - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example)
|
|
4358
|
+
* - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise
|
|
4359
|
+
* the overall value would be negative, see third example)
|
|
4360
|
+
* - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example)
|
|
4361
|
+
*
|
|
4362
|
+
* If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`.
|
|
4016
4363
|
* @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }
|
|
4364
|
+
* @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 }
|
|
4017
4365
|
* @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }
|
|
4366
|
+
* @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 }
|
|
4018
4367
|
* @return {Duration}
|
|
4019
4368
|
*/;
|
|
4020
4369
|
_proto.normalize = function normalize() {
|
|
@@ -4075,16 +4424,13 @@ var Duration = /*#__PURE__*/function () {
|
|
|
4075
4424
|
if (isNumber(vals[k])) {
|
|
4076
4425
|
own += vals[k];
|
|
4077
4426
|
}
|
|
4427
|
+
|
|
4428
|
+
// only keep the integer part for now in the hopes of putting any decimal part
|
|
4429
|
+
// into a smaller unit later
|
|
4078
4430
|
var i = Math.trunc(own);
|
|
4079
4431
|
built[k] = i;
|
|
4080
4432
|
accumulated[k] = (own * 1000 - i * 1000) / 1000;
|
|
4081
4433
|
|
|
4082
|
-
// plus anything further down the chain that should be rolled up in to this
|
|
4083
|
-
for (var down in vals) {
|
|
4084
|
-
if (orderedUnits$1.indexOf(down) > orderedUnits$1.indexOf(k)) {
|
|
4085
|
-
convert(this.matrix, vals, down, built, k);
|
|
4086
|
-
}
|
|
4087
|
-
}
|
|
4088
4434
|
// otherwise, keep it in the wings to boil it later
|
|
4089
4435
|
} else if (isNumber(vals[k])) {
|
|
4090
4436
|
accumulated[k] = vals[k];
|
|
@@ -4098,9 +4444,10 @@ var Duration = /*#__PURE__*/function () {
|
|
|
4098
4444
|
built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];
|
|
4099
4445
|
}
|
|
4100
4446
|
}
|
|
4447
|
+
normalizeValues(this.matrix, built);
|
|
4101
4448
|
return clone$1(this, {
|
|
4102
4449
|
values: built
|
|
4103
|
-
}, true)
|
|
4450
|
+
}, true);
|
|
4104
4451
|
}
|
|
4105
4452
|
|
|
4106
4453
|
/**
|
|
@@ -4294,7 +4641,7 @@ var Duration = /*#__PURE__*/function () {
|
|
|
4294
4641
|
}
|
|
4295
4642
|
}]);
|
|
4296
4643
|
return Duration;
|
|
4297
|
-
}();
|
|
4644
|
+
}(Symbol.for("nodejs.util.inspect.custom"));
|
|
4298
4645
|
|
|
4299
4646
|
var INVALID$1 = "Invalid Interval";
|
|
4300
4647
|
|
|
@@ -4323,7 +4670,7 @@ function validateStartEnd(start, end) {
|
|
|
4323
4670
|
* * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs}
|
|
4324
4671
|
* * **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}.
|
|
4325
4672
|
*/
|
|
4326
|
-
var Interval = /*#__PURE__*/function () {
|
|
4673
|
+
var Interval = /*#__PURE__*/function (_Symbol$for) {
|
|
4327
4674
|
/**
|
|
4328
4675
|
* @private
|
|
4329
4676
|
*/
|
|
@@ -4489,15 +4836,25 @@ var Interval = /*#__PURE__*/function () {
|
|
|
4489
4836
|
* Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'
|
|
4490
4837
|
* asks 'what dates are included in this interval?', not 'how many days long is this interval?'
|
|
4491
4838
|
* @param {string} [unit='milliseconds'] - the unit of time to count.
|
|
4839
|
+
* @param {Object} opts - options
|
|
4840
|
+
* @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
|
|
4492
4841
|
* @return {number}
|
|
4493
4842
|
*/;
|
|
4494
|
-
_proto.count = function count(unit) {
|
|
4843
|
+
_proto.count = function count(unit, opts) {
|
|
4495
4844
|
if (unit === void 0) {
|
|
4496
4845
|
unit = "milliseconds";
|
|
4497
4846
|
}
|
|
4498
4847
|
if (!this.isValid) return NaN;
|
|
4499
|
-
var start = this.start.startOf(unit)
|
|
4500
|
-
|
|
4848
|
+
var start = this.start.startOf(unit, opts);
|
|
4849
|
+
var end;
|
|
4850
|
+
if (opts != null && opts.useLocaleWeeks) {
|
|
4851
|
+
end = this.end.reconfigure({
|
|
4852
|
+
locale: start.locale
|
|
4853
|
+
});
|
|
4854
|
+
} else {
|
|
4855
|
+
end = this.end;
|
|
4856
|
+
}
|
|
4857
|
+
end = end.startOf(unit, opts);
|
|
4501
4858
|
return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());
|
|
4502
4859
|
}
|
|
4503
4860
|
|
|
@@ -4576,7 +4933,9 @@ var Interval = /*#__PURE__*/function () {
|
|
|
4576
4933
|
}
|
|
4577
4934
|
var sorted = dateTimes.map(friendlyDateTime).filter(function (d) {
|
|
4578
4935
|
return _this.contains(d);
|
|
4579
|
-
}).sort()
|
|
4936
|
+
}).sort(function (a, b) {
|
|
4937
|
+
return a.toMillis() - b.toMillis();
|
|
4938
|
+
}),
|
|
4580
4939
|
results = [];
|
|
4581
4940
|
var s = this.s,
|
|
4582
4941
|
i = 0;
|
|
@@ -4801,6 +5160,18 @@ var Interval = /*#__PURE__*/function () {
|
|
|
4801
5160
|
return "[" + this.s.toISO() + " \u2013 " + this.e.toISO() + ")";
|
|
4802
5161
|
}
|
|
4803
5162
|
|
|
5163
|
+
/**
|
|
5164
|
+
* Returns a string representation of this Interval appropriate for the REPL.
|
|
5165
|
+
* @return {string}
|
|
5166
|
+
*/;
|
|
5167
|
+
_proto[_Symbol$for] = function () {
|
|
5168
|
+
if (this.isValid) {
|
|
5169
|
+
return "Interval { start: " + this.s.toISO() + ", end: " + this.e.toISO() + " }";
|
|
5170
|
+
} else {
|
|
5171
|
+
return "Interval { Invalid, reason: " + this.invalidReason + " }";
|
|
5172
|
+
}
|
|
5173
|
+
}
|
|
5174
|
+
|
|
4804
5175
|
/**
|
|
4805
5176
|
* Returns a localized string representing this Interval. Accepts the same options as the
|
|
4806
5177
|
* Intl.DateTimeFormat constructor and any presets defined by Luxon, such as
|
|
@@ -4958,7 +5329,7 @@ var Interval = /*#__PURE__*/function () {
|
|
|
4958
5329
|
}
|
|
4959
5330
|
}]);
|
|
4960
5331
|
return Interval;
|
|
4961
|
-
}();
|
|
5332
|
+
}(Symbol.for("nodejs.util.inspect.custom"));
|
|
4962
5333
|
|
|
4963
5334
|
/**
|
|
4964
5335
|
* 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.
|
|
@@ -5009,6 +5380,56 @@ var Info = /*#__PURE__*/function () {
|
|
|
5009
5380
|
return normalizeZone(input, Settings.defaultZone);
|
|
5010
5381
|
}
|
|
5011
5382
|
|
|
5383
|
+
/**
|
|
5384
|
+
* Get the weekday on which the week starts according to the given locale.
|
|
5385
|
+
* @param {Object} opts - options
|
|
5386
|
+
* @param {string} [opts.locale] - the locale code
|
|
5387
|
+
* @param {string} [opts.locObj=null] - an existing locale object to use
|
|
5388
|
+
* @returns {number} the start of the week, 1 for Monday through 7 for Sunday
|
|
5389
|
+
*/;
|
|
5390
|
+
Info.getStartOfWeek = function getStartOfWeek(_temp) {
|
|
5391
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
5392
|
+
_ref$locale = _ref.locale,
|
|
5393
|
+
locale = _ref$locale === void 0 ? null : _ref$locale,
|
|
5394
|
+
_ref$locObj = _ref.locObj,
|
|
5395
|
+
locObj = _ref$locObj === void 0 ? null : _ref$locObj;
|
|
5396
|
+
return (locObj || Locale.create(locale)).getStartOfWeek();
|
|
5397
|
+
}
|
|
5398
|
+
|
|
5399
|
+
/**
|
|
5400
|
+
* Get the minimum number of days necessary in a week before it is considered part of the next year according
|
|
5401
|
+
* to the given locale.
|
|
5402
|
+
* @param {Object} opts - options
|
|
5403
|
+
* @param {string} [opts.locale] - the locale code
|
|
5404
|
+
* @param {string} [opts.locObj=null] - an existing locale object to use
|
|
5405
|
+
* @returns {number}
|
|
5406
|
+
*/;
|
|
5407
|
+
Info.getMinimumDaysInFirstWeek = function getMinimumDaysInFirstWeek(_temp2) {
|
|
5408
|
+
var _ref2 = _temp2 === void 0 ? {} : _temp2,
|
|
5409
|
+
_ref2$locale = _ref2.locale,
|
|
5410
|
+
locale = _ref2$locale === void 0 ? null : _ref2$locale,
|
|
5411
|
+
_ref2$locObj = _ref2.locObj,
|
|
5412
|
+
locObj = _ref2$locObj === void 0 ? null : _ref2$locObj;
|
|
5413
|
+
return (locObj || Locale.create(locale)).getMinDaysInFirstWeek();
|
|
5414
|
+
}
|
|
5415
|
+
|
|
5416
|
+
/**
|
|
5417
|
+
* Get the weekdays, which are considered the weekend according to the given locale
|
|
5418
|
+
* @param {Object} opts - options
|
|
5419
|
+
* @param {string} [opts.locale] - the locale code
|
|
5420
|
+
* @param {string} [opts.locObj=null] - an existing locale object to use
|
|
5421
|
+
* @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday
|
|
5422
|
+
*/;
|
|
5423
|
+
Info.getWeekendWeekdays = function getWeekendWeekdays(_temp3) {
|
|
5424
|
+
var _ref3 = _temp3 === void 0 ? {} : _temp3,
|
|
5425
|
+
_ref3$locale = _ref3.locale,
|
|
5426
|
+
locale = _ref3$locale === void 0 ? null : _ref3$locale,
|
|
5427
|
+
_ref3$locObj = _ref3.locObj,
|
|
5428
|
+
locObj = _ref3$locObj === void 0 ? null : _ref3$locObj;
|
|
5429
|
+
// copy the array, because we cache it internally
|
|
5430
|
+
return (locObj || Locale.create(locale)).getWeekendDays().slice();
|
|
5431
|
+
}
|
|
5432
|
+
|
|
5012
5433
|
/**
|
|
5013
5434
|
* Return an array of standalone month names.
|
|
5014
5435
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
|
|
@@ -5026,19 +5447,19 @@ var Info = /*#__PURE__*/function () {
|
|
|
5026
5447
|
* @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'
|
|
5027
5448
|
* @return {Array}
|
|
5028
5449
|
*/;
|
|
5029
|
-
Info.months = function months(length,
|
|
5450
|
+
Info.months = function months(length, _temp4) {
|
|
5030
5451
|
if (length === void 0) {
|
|
5031
5452
|
length = "long";
|
|
5032
5453
|
}
|
|
5033
|
-
var
|
|
5034
|
-
|
|
5035
|
-
locale =
|
|
5036
|
-
|
|
5037
|
-
numberingSystem =
|
|
5038
|
-
|
|
5039
|
-
locObj =
|
|
5040
|
-
|
|
5041
|
-
outputCalendar =
|
|
5454
|
+
var _ref4 = _temp4 === void 0 ? {} : _temp4,
|
|
5455
|
+
_ref4$locale = _ref4.locale,
|
|
5456
|
+
locale = _ref4$locale === void 0 ? null : _ref4$locale,
|
|
5457
|
+
_ref4$numberingSystem = _ref4.numberingSystem,
|
|
5458
|
+
numberingSystem = _ref4$numberingSystem === void 0 ? null : _ref4$numberingSystem,
|
|
5459
|
+
_ref4$locObj = _ref4.locObj,
|
|
5460
|
+
locObj = _ref4$locObj === void 0 ? null : _ref4$locObj,
|
|
5461
|
+
_ref4$outputCalendar = _ref4.outputCalendar,
|
|
5462
|
+
outputCalendar = _ref4$outputCalendar === void 0 ? "gregory" : _ref4$outputCalendar;
|
|
5042
5463
|
return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);
|
|
5043
5464
|
}
|
|
5044
5465
|
|
|
@@ -5055,19 +5476,19 @@ var Info = /*#__PURE__*/function () {
|
|
|
5055
5476
|
* @param {string} [opts.outputCalendar='gregory'] - the calendar
|
|
5056
5477
|
* @return {Array}
|
|
5057
5478
|
*/;
|
|
5058
|
-
Info.monthsFormat = function monthsFormat(length,
|
|
5479
|
+
Info.monthsFormat = function monthsFormat(length, _temp5) {
|
|
5059
5480
|
if (length === void 0) {
|
|
5060
5481
|
length = "long";
|
|
5061
5482
|
}
|
|
5062
|
-
var
|
|
5063
|
-
|
|
5064
|
-
locale =
|
|
5065
|
-
|
|
5066
|
-
numberingSystem =
|
|
5067
|
-
|
|
5068
|
-
locObj =
|
|
5069
|
-
|
|
5070
|
-
outputCalendar =
|
|
5483
|
+
var _ref5 = _temp5 === void 0 ? {} : _temp5,
|
|
5484
|
+
_ref5$locale = _ref5.locale,
|
|
5485
|
+
locale = _ref5$locale === void 0 ? null : _ref5$locale,
|
|
5486
|
+
_ref5$numberingSystem = _ref5.numberingSystem,
|
|
5487
|
+
numberingSystem = _ref5$numberingSystem === void 0 ? null : _ref5$numberingSystem,
|
|
5488
|
+
_ref5$locObj = _ref5.locObj,
|
|
5489
|
+
locObj = _ref5$locObj === void 0 ? null : _ref5$locObj,
|
|
5490
|
+
_ref5$outputCalendar = _ref5.outputCalendar,
|
|
5491
|
+
outputCalendar = _ref5$outputCalendar === void 0 ? "gregory" : _ref5$outputCalendar;
|
|
5071
5492
|
return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);
|
|
5072
5493
|
}
|
|
5073
5494
|
|
|
@@ -5085,17 +5506,17 @@ var Info = /*#__PURE__*/function () {
|
|
|
5085
5506
|
* @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'
|
|
5086
5507
|
* @return {Array}
|
|
5087
5508
|
*/;
|
|
5088
|
-
Info.weekdays = function weekdays(length,
|
|
5509
|
+
Info.weekdays = function weekdays(length, _temp6) {
|
|
5089
5510
|
if (length === void 0) {
|
|
5090
5511
|
length = "long";
|
|
5091
5512
|
}
|
|
5092
|
-
var
|
|
5093
|
-
|
|
5094
|
-
locale =
|
|
5095
|
-
|
|
5096
|
-
numberingSystem =
|
|
5097
|
-
|
|
5098
|
-
locObj =
|
|
5513
|
+
var _ref6 = _temp6 === void 0 ? {} : _temp6,
|
|
5514
|
+
_ref6$locale = _ref6.locale,
|
|
5515
|
+
locale = _ref6$locale === void 0 ? null : _ref6$locale,
|
|
5516
|
+
_ref6$numberingSystem = _ref6.numberingSystem,
|
|
5517
|
+
numberingSystem = _ref6$numberingSystem === void 0 ? null : _ref6$numberingSystem,
|
|
5518
|
+
_ref6$locObj = _ref6.locObj,
|
|
5519
|
+
locObj = _ref6$locObj === void 0 ? null : _ref6$locObj;
|
|
5099
5520
|
return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);
|
|
5100
5521
|
}
|
|
5101
5522
|
|
|
@@ -5111,17 +5532,17 @@ var Info = /*#__PURE__*/function () {
|
|
|
5111
5532
|
* @param {string} [opts.locObj=null] - an existing locale object to use
|
|
5112
5533
|
* @return {Array}
|
|
5113
5534
|
*/;
|
|
5114
|
-
Info.weekdaysFormat = function weekdaysFormat(length,
|
|
5535
|
+
Info.weekdaysFormat = function weekdaysFormat(length, _temp7) {
|
|
5115
5536
|
if (length === void 0) {
|
|
5116
5537
|
length = "long";
|
|
5117
5538
|
}
|
|
5118
|
-
var
|
|
5119
|
-
|
|
5120
|
-
locale =
|
|
5121
|
-
|
|
5122
|
-
numberingSystem =
|
|
5123
|
-
|
|
5124
|
-
locObj =
|
|
5539
|
+
var _ref7 = _temp7 === void 0 ? {} : _temp7,
|
|
5540
|
+
_ref7$locale = _ref7.locale,
|
|
5541
|
+
locale = _ref7$locale === void 0 ? null : _ref7$locale,
|
|
5542
|
+
_ref7$numberingSystem = _ref7.numberingSystem,
|
|
5543
|
+
numberingSystem = _ref7$numberingSystem === void 0 ? null : _ref7$numberingSystem,
|
|
5544
|
+
_ref7$locObj = _ref7.locObj,
|
|
5545
|
+
locObj = _ref7$locObj === void 0 ? null : _ref7$locObj;
|
|
5125
5546
|
return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);
|
|
5126
5547
|
}
|
|
5127
5548
|
|
|
@@ -5133,10 +5554,10 @@ var Info = /*#__PURE__*/function () {
|
|
|
5133
5554
|
* @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]
|
|
5134
5555
|
* @return {Array}
|
|
5135
5556
|
*/;
|
|
5136
|
-
Info.meridiems = function meridiems(
|
|
5137
|
-
var
|
|
5138
|
-
|
|
5139
|
-
locale =
|
|
5557
|
+
Info.meridiems = function meridiems(_temp8) {
|
|
5558
|
+
var _ref8 = _temp8 === void 0 ? {} : _temp8,
|
|
5559
|
+
_ref8$locale = _ref8.locale,
|
|
5560
|
+
locale = _ref8$locale === void 0 ? null : _ref8$locale;
|
|
5140
5561
|
return Locale.create(locale).meridiems();
|
|
5141
5562
|
}
|
|
5142
5563
|
|
|
@@ -5150,13 +5571,13 @@ var Info = /*#__PURE__*/function () {
|
|
|
5150
5571
|
* @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]
|
|
5151
5572
|
* @return {Array}
|
|
5152
5573
|
*/;
|
|
5153
|
-
Info.eras = function eras(length,
|
|
5574
|
+
Info.eras = function eras(length, _temp9) {
|
|
5154
5575
|
if (length === void 0) {
|
|
5155
5576
|
length = "short";
|
|
5156
5577
|
}
|
|
5157
|
-
var
|
|
5158
|
-
|
|
5159
|
-
locale =
|
|
5578
|
+
var _ref9 = _temp9 === void 0 ? {} : _temp9,
|
|
5579
|
+
_ref9$locale = _ref9.locale,
|
|
5580
|
+
locale = _ref9$locale === void 0 ? null : _ref9$locale;
|
|
5160
5581
|
return Locale.create(locale, null, "gregory").eras(length);
|
|
5161
5582
|
}
|
|
5162
5583
|
|
|
@@ -5165,12 +5586,14 @@ var Info = /*#__PURE__*/function () {
|
|
|
5165
5586
|
* 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.
|
|
5166
5587
|
* Keys:
|
|
5167
5588
|
* * `relative`: whether this environment supports relative time formatting
|
|
5168
|
-
*
|
|
5589
|
+
* * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale
|
|
5590
|
+
* @example Info.features() //=> { relative: false, localeWeek: true }
|
|
5169
5591
|
* @return {Object}
|
|
5170
5592
|
*/;
|
|
5171
5593
|
Info.features = function features() {
|
|
5172
5594
|
return {
|
|
5173
|
-
relative: hasRelative()
|
|
5595
|
+
relative: hasRelative(),
|
|
5596
|
+
localeWeek: hasLocaleWeekInfo()
|
|
5174
5597
|
};
|
|
5175
5598
|
};
|
|
5176
5599
|
return Info;
|
|
@@ -5199,6 +5622,15 @@ function highOrderDiffs(cursor, later, units) {
|
|
|
5199
5622
|
var results = {};
|
|
5200
5623
|
var earlier = cursor;
|
|
5201
5624
|
var lowestOrder, highWater;
|
|
5625
|
+
|
|
5626
|
+
/* This loop tries to diff using larger units first.
|
|
5627
|
+
If we overshoot, we backtrack and try the next smaller unit.
|
|
5628
|
+
"cursor" starts out at the earlier timestamp and moves closer and closer to "later"
|
|
5629
|
+
as we use smaller and smaller units.
|
|
5630
|
+
highWater keeps track of where we would be if we added one more of the smallest unit,
|
|
5631
|
+
this is used later to potentially convert any difference smaller than the smallest higher order unit
|
|
5632
|
+
into a fraction of that smallest higher order unit
|
|
5633
|
+
*/
|
|
5202
5634
|
for (var _i = 0, _differs = differs; _i < _differs.length; _i++) {
|
|
5203
5635
|
var _differs$_i = _differs[_i],
|
|
5204
5636
|
unit = _differs$_i[0],
|
|
@@ -5208,8 +5640,20 @@ function highOrderDiffs(cursor, later, units) {
|
|
|
5208
5640
|
results[unit] = differ(cursor, later);
|
|
5209
5641
|
highWater = earlier.plus(results);
|
|
5210
5642
|
if (highWater > later) {
|
|
5643
|
+
// we overshot the end point, backtrack cursor by 1
|
|
5211
5644
|
results[unit]--;
|
|
5212
5645
|
cursor = earlier.plus(results);
|
|
5646
|
+
|
|
5647
|
+
// if we are still overshooting now, we need to backtrack again
|
|
5648
|
+
// this happens in certain situations when diffing times in different zones,
|
|
5649
|
+
// because this calculation ignores time zones
|
|
5650
|
+
if (cursor > later) {
|
|
5651
|
+
// keep the "overshot by 1" around as highWater
|
|
5652
|
+
highWater = cursor;
|
|
5653
|
+
// backtrack cursor by 1
|
|
5654
|
+
results[unit]--;
|
|
5655
|
+
cursor = earlier.plus(results);
|
|
5656
|
+
}
|
|
5213
5657
|
} else {
|
|
5214
5658
|
cursor = highWater;
|
|
5215
5659
|
}
|
|
@@ -5388,6 +5832,11 @@ function simple(regex) {
|
|
|
5388
5832
|
function escapeToken(value) {
|
|
5389
5833
|
return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
5390
5834
|
}
|
|
5835
|
+
|
|
5836
|
+
/**
|
|
5837
|
+
* @param token
|
|
5838
|
+
* @param {Locale} loc
|
|
5839
|
+
*/
|
|
5391
5840
|
function unitForToken(token, loc) {
|
|
5392
5841
|
var one = digitRegex(loc),
|
|
5393
5842
|
two = digitRegex(loc, "{2}"),
|
|
@@ -5417,9 +5866,9 @@ function unitForToken(token, loc) {
|
|
|
5417
5866
|
switch (t.val) {
|
|
5418
5867
|
// era
|
|
5419
5868
|
case "G":
|
|
5420
|
-
return oneOf(loc.eras("short"
|
|
5869
|
+
return oneOf(loc.eras("short"), 0);
|
|
5421
5870
|
case "GG":
|
|
5422
|
-
return oneOf(loc.eras("long"
|
|
5871
|
+
return oneOf(loc.eras("long"), 0);
|
|
5423
5872
|
// years
|
|
5424
5873
|
case "y":
|
|
5425
5874
|
return intUnit(oneToSix);
|
|
@@ -5437,17 +5886,17 @@ function unitForToken(token, loc) {
|
|
|
5437
5886
|
case "MM":
|
|
5438
5887
|
return intUnit(two);
|
|
5439
5888
|
case "MMM":
|
|
5440
|
-
return oneOf(loc.months("short", true
|
|
5889
|
+
return oneOf(loc.months("short", true), 1);
|
|
5441
5890
|
case "MMMM":
|
|
5442
|
-
return oneOf(loc.months("long", true
|
|
5891
|
+
return oneOf(loc.months("long", true), 1);
|
|
5443
5892
|
case "L":
|
|
5444
5893
|
return intUnit(oneOrTwo);
|
|
5445
5894
|
case "LL":
|
|
5446
5895
|
return intUnit(two);
|
|
5447
5896
|
case "LLL":
|
|
5448
|
-
return oneOf(loc.months("short", false
|
|
5897
|
+
return oneOf(loc.months("short", false), 1);
|
|
5449
5898
|
case "LLLL":
|
|
5450
|
-
return oneOf(loc.months("long", false
|
|
5899
|
+
return oneOf(loc.months("long", false), 1);
|
|
5451
5900
|
// dates
|
|
5452
5901
|
case "d":
|
|
5453
5902
|
return intUnit(oneOrTwo);
|
|
@@ -5507,13 +5956,13 @@ function unitForToken(token, loc) {
|
|
|
5507
5956
|
case "c":
|
|
5508
5957
|
return intUnit(one);
|
|
5509
5958
|
case "EEE":
|
|
5510
|
-
return oneOf(loc.weekdays("short", false
|
|
5959
|
+
return oneOf(loc.weekdays("short", false), 1);
|
|
5511
5960
|
case "EEEE":
|
|
5512
|
-
return oneOf(loc.weekdays("long", false
|
|
5961
|
+
return oneOf(loc.weekdays("long", false), 1);
|
|
5513
5962
|
case "ccc":
|
|
5514
|
-
return oneOf(loc.weekdays("short", true
|
|
5963
|
+
return oneOf(loc.weekdays("short", true), 1);
|
|
5515
5964
|
case "cccc":
|
|
5516
|
-
return oneOf(loc.weekdays("long", true
|
|
5965
|
+
return oneOf(loc.weekdays("long", true), 1);
|
|
5517
5966
|
// offset/zone
|
|
5518
5967
|
case "Z":
|
|
5519
5968
|
case "ZZ":
|
|
@@ -5559,10 +6008,14 @@ var partTypeStyleToTokenVal = {
|
|
|
5559
6008
|
},
|
|
5560
6009
|
dayperiod: "a",
|
|
5561
6010
|
dayPeriod: "a",
|
|
5562
|
-
|
|
6011
|
+
hour12: {
|
|
5563
6012
|
numeric: "h",
|
|
5564
6013
|
"2-digit": "hh"
|
|
5565
6014
|
},
|
|
6015
|
+
hour24: {
|
|
6016
|
+
numeric: "H",
|
|
6017
|
+
"2-digit": "HH"
|
|
6018
|
+
},
|
|
5566
6019
|
minute: {
|
|
5567
6020
|
numeric: "m",
|
|
5568
6021
|
"2-digit": "mm"
|
|
@@ -5576,7 +6029,7 @@ var partTypeStyleToTokenVal = {
|
|
|
5576
6029
|
short: "ZZZ"
|
|
5577
6030
|
}
|
|
5578
6031
|
};
|
|
5579
|
-
function tokenForPart(part, formatOpts) {
|
|
6032
|
+
function tokenForPart(part, formatOpts, resolvedOpts) {
|
|
5580
6033
|
var type = part.type,
|
|
5581
6034
|
value = part.value;
|
|
5582
6035
|
if (type === "literal") {
|
|
@@ -5587,7 +6040,27 @@ function tokenForPart(part, formatOpts) {
|
|
|
5587
6040
|
};
|
|
5588
6041
|
}
|
|
5589
6042
|
var style = formatOpts[type];
|
|
5590
|
-
|
|
6043
|
+
|
|
6044
|
+
// The user might have explicitly specified hour12 or hourCycle
|
|
6045
|
+
// if so, respect their decision
|
|
6046
|
+
// if not, refer back to the resolvedOpts, which are based on the locale
|
|
6047
|
+
var actualType = type;
|
|
6048
|
+
if (type === "hour") {
|
|
6049
|
+
if (formatOpts.hour12 != null) {
|
|
6050
|
+
actualType = formatOpts.hour12 ? "hour12" : "hour24";
|
|
6051
|
+
} else if (formatOpts.hourCycle != null) {
|
|
6052
|
+
if (formatOpts.hourCycle === "h11" || formatOpts.hourCycle === "h12") {
|
|
6053
|
+
actualType = "hour12";
|
|
6054
|
+
} else {
|
|
6055
|
+
actualType = "hour24";
|
|
6056
|
+
}
|
|
6057
|
+
} else {
|
|
6058
|
+
// tokens only differentiate between 24 hours or not,
|
|
6059
|
+
// so we do not need to check hourCycle here, which is less supported anyways
|
|
6060
|
+
actualType = resolvedOpts.hour12 ? "hour12" : "hour24";
|
|
6061
|
+
}
|
|
6062
|
+
}
|
|
6063
|
+
var val = partTypeStyleToTokenVal[actualType];
|
|
5591
6064
|
if (typeof val === "object") {
|
|
5592
6065
|
val = val[style];
|
|
5593
6066
|
}
|
|
@@ -5780,168 +6253,14 @@ function formatOptsToTokens(formatOpts, locale) {
|
|
|
5780
6253
|
return null;
|
|
5781
6254
|
}
|
|
5782
6255
|
var formatter = Formatter.create(locale, formatOpts);
|
|
5783
|
-
var
|
|
6256
|
+
var df = formatter.dtFormatter(getDummyDateTime());
|
|
6257
|
+
var parts = df.formatToParts();
|
|
6258
|
+
var resolvedOpts = df.resolvedOptions();
|
|
5784
6259
|
return parts.map(function (p) {
|
|
5785
|
-
return tokenForPart(p, formatOpts);
|
|
6260
|
+
return tokenForPart(p, formatOpts, resolvedOpts);
|
|
5786
6261
|
});
|
|
5787
6262
|
}
|
|
5788
6263
|
|
|
5789
|
-
var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
|
|
5790
|
-
leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
|
|
5791
|
-
function unitOutOfRange(unit, value) {
|
|
5792
|
-
return new Invalid("unit out of range", "you specified " + value + " (of type " + typeof value + ") as a " + unit + ", which is invalid");
|
|
5793
|
-
}
|
|
5794
|
-
function dayOfWeek(year, month, day) {
|
|
5795
|
-
var d = new Date(Date.UTC(year, month - 1, day));
|
|
5796
|
-
if (year < 100 && year >= 0) {
|
|
5797
|
-
d.setUTCFullYear(d.getUTCFullYear() - 1900);
|
|
5798
|
-
}
|
|
5799
|
-
var js = d.getUTCDay();
|
|
5800
|
-
return js === 0 ? 7 : js;
|
|
5801
|
-
}
|
|
5802
|
-
function computeOrdinal(year, month, day) {
|
|
5803
|
-
return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
|
|
5804
|
-
}
|
|
5805
|
-
function uncomputeOrdinal(year, ordinal) {
|
|
5806
|
-
var table = isLeapYear(year) ? leapLadder : nonLeapLadder,
|
|
5807
|
-
month0 = table.findIndex(function (i) {
|
|
5808
|
-
return i < ordinal;
|
|
5809
|
-
}),
|
|
5810
|
-
day = ordinal - table[month0];
|
|
5811
|
-
return {
|
|
5812
|
-
month: month0 + 1,
|
|
5813
|
-
day: day
|
|
5814
|
-
};
|
|
5815
|
-
}
|
|
5816
|
-
|
|
5817
|
-
/**
|
|
5818
|
-
* @private
|
|
5819
|
-
*/
|
|
5820
|
-
|
|
5821
|
-
function gregorianToWeek(gregObj) {
|
|
5822
|
-
var year = gregObj.year,
|
|
5823
|
-
month = gregObj.month,
|
|
5824
|
-
day = gregObj.day,
|
|
5825
|
-
ordinal = computeOrdinal(year, month, day),
|
|
5826
|
-
weekday = dayOfWeek(year, month, day);
|
|
5827
|
-
var weekNumber = Math.floor((ordinal - weekday + 10) / 7),
|
|
5828
|
-
weekYear;
|
|
5829
|
-
if (weekNumber < 1) {
|
|
5830
|
-
weekYear = year - 1;
|
|
5831
|
-
weekNumber = weeksInWeekYear(weekYear);
|
|
5832
|
-
} else if (weekNumber > weeksInWeekYear(year)) {
|
|
5833
|
-
weekYear = year + 1;
|
|
5834
|
-
weekNumber = 1;
|
|
5835
|
-
} else {
|
|
5836
|
-
weekYear = year;
|
|
5837
|
-
}
|
|
5838
|
-
return _extends({
|
|
5839
|
-
weekYear: weekYear,
|
|
5840
|
-
weekNumber: weekNumber,
|
|
5841
|
-
weekday: weekday
|
|
5842
|
-
}, timeObject(gregObj));
|
|
5843
|
-
}
|
|
5844
|
-
function weekToGregorian(weekData) {
|
|
5845
|
-
var weekYear = weekData.weekYear,
|
|
5846
|
-
weekNumber = weekData.weekNumber,
|
|
5847
|
-
weekday = weekData.weekday,
|
|
5848
|
-
weekdayOfJan4 = dayOfWeek(weekYear, 1, 4),
|
|
5849
|
-
yearInDays = daysInYear(weekYear);
|
|
5850
|
-
var ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3,
|
|
5851
|
-
year;
|
|
5852
|
-
if (ordinal < 1) {
|
|
5853
|
-
year = weekYear - 1;
|
|
5854
|
-
ordinal += daysInYear(year);
|
|
5855
|
-
} else if (ordinal > yearInDays) {
|
|
5856
|
-
year = weekYear + 1;
|
|
5857
|
-
ordinal -= daysInYear(weekYear);
|
|
5858
|
-
} else {
|
|
5859
|
-
year = weekYear;
|
|
5860
|
-
}
|
|
5861
|
-
var _uncomputeOrdinal = uncomputeOrdinal(year, ordinal),
|
|
5862
|
-
month = _uncomputeOrdinal.month,
|
|
5863
|
-
day = _uncomputeOrdinal.day;
|
|
5864
|
-
return _extends({
|
|
5865
|
-
year: year,
|
|
5866
|
-
month: month,
|
|
5867
|
-
day: day
|
|
5868
|
-
}, timeObject(weekData));
|
|
5869
|
-
}
|
|
5870
|
-
function gregorianToOrdinal(gregData) {
|
|
5871
|
-
var year = gregData.year,
|
|
5872
|
-
month = gregData.month,
|
|
5873
|
-
day = gregData.day;
|
|
5874
|
-
var ordinal = computeOrdinal(year, month, day);
|
|
5875
|
-
return _extends({
|
|
5876
|
-
year: year,
|
|
5877
|
-
ordinal: ordinal
|
|
5878
|
-
}, timeObject(gregData));
|
|
5879
|
-
}
|
|
5880
|
-
function ordinalToGregorian(ordinalData) {
|
|
5881
|
-
var year = ordinalData.year,
|
|
5882
|
-
ordinal = ordinalData.ordinal;
|
|
5883
|
-
var _uncomputeOrdinal2 = uncomputeOrdinal(year, ordinal),
|
|
5884
|
-
month = _uncomputeOrdinal2.month,
|
|
5885
|
-
day = _uncomputeOrdinal2.day;
|
|
5886
|
-
return _extends({
|
|
5887
|
-
year: year,
|
|
5888
|
-
month: month,
|
|
5889
|
-
day: day
|
|
5890
|
-
}, timeObject(ordinalData));
|
|
5891
|
-
}
|
|
5892
|
-
function hasInvalidWeekData(obj) {
|
|
5893
|
-
var validYear = isInteger(obj.weekYear),
|
|
5894
|
-
validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)),
|
|
5895
|
-
validWeekday = integerBetween(obj.weekday, 1, 7);
|
|
5896
|
-
if (!validYear) {
|
|
5897
|
-
return unitOutOfRange("weekYear", obj.weekYear);
|
|
5898
|
-
} else if (!validWeek) {
|
|
5899
|
-
return unitOutOfRange("week", obj.week);
|
|
5900
|
-
} else if (!validWeekday) {
|
|
5901
|
-
return unitOutOfRange("weekday", obj.weekday);
|
|
5902
|
-
} else return false;
|
|
5903
|
-
}
|
|
5904
|
-
function hasInvalidOrdinalData(obj) {
|
|
5905
|
-
var validYear = isInteger(obj.year),
|
|
5906
|
-
validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
|
|
5907
|
-
if (!validYear) {
|
|
5908
|
-
return unitOutOfRange("year", obj.year);
|
|
5909
|
-
} else if (!validOrdinal) {
|
|
5910
|
-
return unitOutOfRange("ordinal", obj.ordinal);
|
|
5911
|
-
} else return false;
|
|
5912
|
-
}
|
|
5913
|
-
function hasInvalidGregorianData(obj) {
|
|
5914
|
-
var validYear = isInteger(obj.year),
|
|
5915
|
-
validMonth = integerBetween(obj.month, 1, 12),
|
|
5916
|
-
validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
|
|
5917
|
-
if (!validYear) {
|
|
5918
|
-
return unitOutOfRange("year", obj.year);
|
|
5919
|
-
} else if (!validMonth) {
|
|
5920
|
-
return unitOutOfRange("month", obj.month);
|
|
5921
|
-
} else if (!validDay) {
|
|
5922
|
-
return unitOutOfRange("day", obj.day);
|
|
5923
|
-
} else return false;
|
|
5924
|
-
}
|
|
5925
|
-
function hasInvalidTimeData(obj) {
|
|
5926
|
-
var hour = obj.hour,
|
|
5927
|
-
minute = obj.minute,
|
|
5928
|
-
second = obj.second,
|
|
5929
|
-
millisecond = obj.millisecond;
|
|
5930
|
-
var validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0,
|
|
5931
|
-
validMinute = integerBetween(minute, 0, 59),
|
|
5932
|
-
validSecond = integerBetween(second, 0, 59),
|
|
5933
|
-
validMillisecond = integerBetween(millisecond, 0, 999);
|
|
5934
|
-
if (!validHour) {
|
|
5935
|
-
return unitOutOfRange("hour", hour);
|
|
5936
|
-
} else if (!validMinute) {
|
|
5937
|
-
return unitOutOfRange("minute", minute);
|
|
5938
|
-
} else if (!validSecond) {
|
|
5939
|
-
return unitOutOfRange("second", second);
|
|
5940
|
-
} else if (!validMillisecond) {
|
|
5941
|
-
return unitOutOfRange("millisecond", millisecond);
|
|
5942
|
-
} else return false;
|
|
5943
|
-
}
|
|
5944
|
-
|
|
5945
6264
|
var INVALID = "Invalid DateTime";
|
|
5946
6265
|
var MAX_DATE = 8.64e15;
|
|
5947
6266
|
function unsupportedZone(zone) {
|
|
@@ -5949,6 +6268,9 @@ function unsupportedZone(zone) {
|
|
|
5949
6268
|
}
|
|
5950
6269
|
|
|
5951
6270
|
// we cache week data on the DT object and this intermediates the cache
|
|
6271
|
+
/**
|
|
6272
|
+
* @param {DateTime} dt
|
|
6273
|
+
*/
|
|
5952
6274
|
function possiblyCachedWeekData(dt) {
|
|
5953
6275
|
if (dt.weekData === null) {
|
|
5954
6276
|
dt.weekData = gregorianToWeek(dt.c);
|
|
@@ -5956,6 +6278,16 @@ function possiblyCachedWeekData(dt) {
|
|
|
5956
6278
|
return dt.weekData;
|
|
5957
6279
|
}
|
|
5958
6280
|
|
|
6281
|
+
/**
|
|
6282
|
+
* @param {DateTime} dt
|
|
6283
|
+
*/
|
|
6284
|
+
function possiblyCachedLocalWeekData(dt) {
|
|
6285
|
+
if (dt.localWeekData === null) {
|
|
6286
|
+
dt.localWeekData = gregorianToWeek(dt.c, dt.loc.getMinDaysInFirstWeek(), dt.loc.getStartOfWeek());
|
|
6287
|
+
}
|
|
6288
|
+
return dt.localWeekData;
|
|
6289
|
+
}
|
|
6290
|
+
|
|
5959
6291
|
// clone really means, "make a new object with these modifications". all "setters" really use this
|
|
5960
6292
|
// to create a new object while only changing some of the properties
|
|
5961
6293
|
function clone(inst, alts) {
|
|
@@ -6104,13 +6436,13 @@ function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeO
|
|
|
6104
6436
|
if (extended) {
|
|
6105
6437
|
c += ":";
|
|
6106
6438
|
c += padStart(o.c.minute);
|
|
6107
|
-
if (o.c.second !== 0 || !suppressSeconds) {
|
|
6439
|
+
if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
|
|
6108
6440
|
c += ":";
|
|
6109
6441
|
}
|
|
6110
6442
|
} else {
|
|
6111
6443
|
c += padStart(o.c.minute);
|
|
6112
6444
|
}
|
|
6113
|
-
if (o.c.second !== 0 || !suppressSeconds) {
|
|
6445
|
+
if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
|
|
6114
6446
|
c += padStart(o.c.second);
|
|
6115
6447
|
if (o.c.millisecond !== 0 || !suppressMilliseconds) {
|
|
6116
6448
|
c += ".";
|
|
@@ -6199,6 +6531,21 @@ function normalizeUnit(unit) {
|
|
|
6199
6531
|
if (!normalized) throw new InvalidUnitError(unit);
|
|
6200
6532
|
return normalized;
|
|
6201
6533
|
}
|
|
6534
|
+
function normalizeUnitWithLocalWeeks(unit) {
|
|
6535
|
+
switch (unit.toLowerCase()) {
|
|
6536
|
+
case "localweekday":
|
|
6537
|
+
case "localweekdays":
|
|
6538
|
+
return "localWeekday";
|
|
6539
|
+
case "localweeknumber":
|
|
6540
|
+
case "localweeknumbers":
|
|
6541
|
+
return "localWeekNumber";
|
|
6542
|
+
case "localweekyear":
|
|
6543
|
+
case "localweekyears":
|
|
6544
|
+
return "localWeekYear";
|
|
6545
|
+
default:
|
|
6546
|
+
return normalizeUnit(unit);
|
|
6547
|
+
}
|
|
6548
|
+
}
|
|
6202
6549
|
|
|
6203
6550
|
// this is a dumbed down version of fromObject() that runs about 60% faster
|
|
6204
6551
|
// but doesn't do any validation, makes a bunch of assumptions about what units
|
|
@@ -6295,7 +6642,7 @@ function lastOpts(argList) {
|
|
|
6295
6642
|
*
|
|
6296
6643
|
* 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.
|
|
6297
6644
|
*/
|
|
6298
|
-
var DateTime = /*#__PURE__*/function () {
|
|
6645
|
+
var DateTime = /*#__PURE__*/function (_Symbol$for) {
|
|
6299
6646
|
/**
|
|
6300
6647
|
* @access private
|
|
6301
6648
|
*/
|
|
@@ -6339,6 +6686,10 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6339
6686
|
* @access private
|
|
6340
6687
|
*/
|
|
6341
6688
|
this.weekData = null;
|
|
6689
|
+
/**
|
|
6690
|
+
* @access private
|
|
6691
|
+
*/
|
|
6692
|
+
this.localWeekData = null;
|
|
6342
6693
|
/**
|
|
6343
6694
|
* @access private
|
|
6344
6695
|
*/
|
|
@@ -6545,13 +6896,16 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6545
6896
|
* @param {number} obj.weekYear - an ISO week year
|
|
6546
6897
|
* @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year
|
|
6547
6898
|
* @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday
|
|
6899
|
+
* @param {number} obj.localWeekYear - a week year, according to the locale
|
|
6900
|
+
* @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale
|
|
6901
|
+
* @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
|
|
6548
6902
|
* @param {number} obj.hour - hour of the day, 0-23
|
|
6549
6903
|
* @param {number} obj.minute - minute of the hour, 0-59
|
|
6550
6904
|
* @param {number} obj.second - second of the minute, 0-59
|
|
6551
6905
|
* @param {number} obj.millisecond - millisecond of the second, 0-999
|
|
6552
6906
|
* @param {Object} opts - options for creating this DateTime
|
|
6553
6907
|
* @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()
|
|
6554
|
-
* @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance
|
|
6908
|
+
* @param {string} [opts.locale='system\'s locale'] - a locale to set on the resulting DateTime instance
|
|
6555
6909
|
* @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
|
|
6556
6910
|
* @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance
|
|
6557
6911
|
* @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'
|
|
@@ -6561,6 +6915,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6561
6915
|
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' })
|
|
6562
6916
|
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' })
|
|
6563
6917
|
* @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'
|
|
6918
|
+
* @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: "en-US" }).toISODate() //=> '2021-12-26'
|
|
6564
6919
|
* @return {DateTime}
|
|
6565
6920
|
*/;
|
|
6566
6921
|
DateTime.fromObject = function fromObject(obj, opts) {
|
|
@@ -6572,15 +6927,18 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6572
6927
|
if (!zoneToUse.isValid) {
|
|
6573
6928
|
return DateTime.invalid(unsupportedZone(zoneToUse));
|
|
6574
6929
|
}
|
|
6930
|
+
var loc = Locale.fromObject(opts);
|
|
6931
|
+
var normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);
|
|
6932
|
+
var _usesLocalWeekValues = usesLocalWeekValues(normalized, loc),
|
|
6933
|
+
minDaysInFirstWeek = _usesLocalWeekValues.minDaysInFirstWeek,
|
|
6934
|
+
startOfWeek = _usesLocalWeekValues.startOfWeek;
|
|
6575
6935
|
var tsNow = Settings.now(),
|
|
6576
6936
|
offsetProvis = !isUndefined(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow),
|
|
6577
|
-
normalized = normalizeObject(obj, normalizeUnit),
|
|
6578
6937
|
containsOrdinal = !isUndefined(normalized.ordinal),
|
|
6579
6938
|
containsGregorYear = !isUndefined(normalized.year),
|
|
6580
6939
|
containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),
|
|
6581
6940
|
containsGregor = containsGregorYear || containsGregorMD,
|
|
6582
|
-
definiteWeekDef = normalized.weekYear || normalized.weekNumber
|
|
6583
|
-
loc = Locale.fromObject(opts);
|
|
6941
|
+
definiteWeekDef = normalized.weekYear || normalized.weekNumber;
|
|
6584
6942
|
|
|
6585
6943
|
// cases:
|
|
6586
6944
|
// just a weekday -> this week's instance of that weekday, no worries
|
|
@@ -6603,7 +6961,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6603
6961
|
if (useWeekData) {
|
|
6604
6962
|
units = orderedWeekUnits;
|
|
6605
6963
|
defaultValues = defaultWeekUnitValues;
|
|
6606
|
-
objNow = gregorianToWeek(objNow);
|
|
6964
|
+
objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek);
|
|
6607
6965
|
} else if (containsOrdinal) {
|
|
6608
6966
|
units = orderedOrdinalUnits;
|
|
6609
6967
|
defaultValues = defaultOrdinalUnitValues;
|
|
@@ -6628,14 +6986,14 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6628
6986
|
}
|
|
6629
6987
|
|
|
6630
6988
|
// make sure the values we have are in range
|
|
6631
|
-
var higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized),
|
|
6989
|
+
var higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized),
|
|
6632
6990
|
invalid = higherOrderInvalid || hasInvalidTimeData(normalized);
|
|
6633
6991
|
if (invalid) {
|
|
6634
6992
|
return DateTime.invalid(invalid);
|
|
6635
6993
|
}
|
|
6636
6994
|
|
|
6637
6995
|
// compute the actual time
|
|
6638
|
-
var gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized,
|
|
6996
|
+
var gregorian = useWeekData ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? ordinalToGregorian(normalized) : normalized,
|
|
6639
6997
|
_objToTS2 = objToTS(gregorian, offsetProvis, zoneToUse),
|
|
6640
6998
|
tsFinal = _objToTS2[0],
|
|
6641
6999
|
offsetFinal = _objToTS2[1],
|
|
@@ -6812,7 +7170,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6812
7170
|
|
|
6813
7171
|
/**
|
|
6814
7172
|
* Create an invalid DateTime.
|
|
6815
|
-
* @param {
|
|
7173
|
+
* @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent.
|
|
6816
7174
|
* @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information
|
|
6817
7175
|
* @return {DateTime}
|
|
6818
7176
|
*/;
|
|
@@ -6895,6 +7253,47 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
6895
7253
|
* * The DateTime was created by an operation on another invalid date
|
|
6896
7254
|
* @type {boolean}
|
|
6897
7255
|
*/;
|
|
7256
|
+
/**
|
|
7257
|
+
* Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC
|
|
7258
|
+
* in this DateTime's zone. During DST changes local time can be ambiguous, for example
|
|
7259
|
+
* `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`.
|
|
7260
|
+
* This method will return both possible DateTimes if this DateTime's local time is ambiguous.
|
|
7261
|
+
* @returns {DateTime[]}
|
|
7262
|
+
*/
|
|
7263
|
+
_proto.getPossibleOffsets = function getPossibleOffsets() {
|
|
7264
|
+
if (!this.isValid || this.isOffsetFixed) {
|
|
7265
|
+
return [this];
|
|
7266
|
+
}
|
|
7267
|
+
var dayMs = 86400000;
|
|
7268
|
+
var minuteMs = 60000;
|
|
7269
|
+
var localTS = objToLocalTS(this.c);
|
|
7270
|
+
var oEarlier = this.zone.offset(localTS - dayMs);
|
|
7271
|
+
var oLater = this.zone.offset(localTS + dayMs);
|
|
7272
|
+
var o1 = this.zone.offset(localTS - oEarlier * minuteMs);
|
|
7273
|
+
var o2 = this.zone.offset(localTS - oLater * minuteMs);
|
|
7274
|
+
if (o1 === o2) {
|
|
7275
|
+
return [this];
|
|
7276
|
+
}
|
|
7277
|
+
var ts1 = localTS - o1 * minuteMs;
|
|
7278
|
+
var ts2 = localTS - o2 * minuteMs;
|
|
7279
|
+
var c1 = tsToObj(ts1, o1);
|
|
7280
|
+
var c2 = tsToObj(ts2, o2);
|
|
7281
|
+
if (c1.hour === c2.hour && c1.minute === c2.minute && c1.second === c2.second && c1.millisecond === c2.millisecond) {
|
|
7282
|
+
return [clone(this, {
|
|
7283
|
+
ts: ts1
|
|
7284
|
+
}), clone(this, {
|
|
7285
|
+
ts: ts2
|
|
7286
|
+
})];
|
|
7287
|
+
}
|
|
7288
|
+
return [this];
|
|
7289
|
+
}
|
|
7290
|
+
|
|
7291
|
+
/**
|
|
7292
|
+
* Returns true if this DateTime is in a leap year, false otherwise
|
|
7293
|
+
* @example DateTime.local(2016).isInLeapYear //=> true
|
|
7294
|
+
* @example DateTime.local(2013).isInLeapYear //=> false
|
|
7295
|
+
* @type {boolean}
|
|
7296
|
+
*/;
|
|
6898
7297
|
/**
|
|
6899
7298
|
* Returns the resolved Intl options for this DateTime.
|
|
6900
7299
|
* This is useful in understanding the behavior of formatting methods
|
|
@@ -7017,6 +7416,9 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7017
7416
|
/**
|
|
7018
7417
|
* "Set" the values of specified units. Returns a newly-constructed DateTime.
|
|
7019
7418
|
* You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}.
|
|
7419
|
+
*
|
|
7420
|
+
* This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`.
|
|
7421
|
+
* They cannot be mixed with ISO-week units like `weekday`.
|
|
7020
7422
|
* @param {Object} values - a mapping of units to numbers
|
|
7021
7423
|
* @example dt.set({ year: 2017 })
|
|
7022
7424
|
* @example dt.set({ hour: 8, minute: 30 })
|
|
@@ -7026,8 +7428,11 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7026
7428
|
*/;
|
|
7027
7429
|
_proto.set = function set(values) {
|
|
7028
7430
|
if (!this.isValid) return this;
|
|
7029
|
-
var normalized = normalizeObject(values,
|
|
7030
|
-
|
|
7431
|
+
var normalized = normalizeObject(values, normalizeUnitWithLocalWeeks);
|
|
7432
|
+
var _usesLocalWeekValues2 = usesLocalWeekValues(normalized, this.loc),
|
|
7433
|
+
minDaysInFirstWeek = _usesLocalWeekValues2.minDaysInFirstWeek,
|
|
7434
|
+
startOfWeek = _usesLocalWeekValues2.startOfWeek;
|
|
7435
|
+
var settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday),
|
|
7031
7436
|
containsOrdinal = !isUndefined(normalized.ordinal),
|
|
7032
7437
|
containsGregorYear = !isUndefined(normalized.year),
|
|
7033
7438
|
containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),
|
|
@@ -7041,7 +7446,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7041
7446
|
}
|
|
7042
7447
|
var mixed;
|
|
7043
7448
|
if (settingWeekStuff) {
|
|
7044
|
-
mixed = weekToGregorian(_extends({}, gregorianToWeek(this.c), normalized));
|
|
7449
|
+
mixed = weekToGregorian(_extends({}, gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek), normalized), minDaysInFirstWeek, startOfWeek);
|
|
7045
7450
|
} else if (!isUndefined(normalized.ordinal)) {
|
|
7046
7451
|
mixed = ordinalToGregorian(_extends({}, gregorianToOrdinal(this.c), normalized));
|
|
7047
7452
|
} else {
|
|
@@ -7096,6 +7501,8 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7096
7501
|
/**
|
|
7097
7502
|
* "Set" this DateTime to the beginning of a unit of time.
|
|
7098
7503
|
* @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
|
|
7504
|
+
* @param {Object} opts - options
|
|
7505
|
+
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
|
|
7099
7506
|
* @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'
|
|
7100
7507
|
* @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'
|
|
7101
7508
|
* @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays
|
|
@@ -7103,7 +7510,10 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7103
7510
|
* @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'
|
|
7104
7511
|
* @return {DateTime}
|
|
7105
7512
|
*/;
|
|
7106
|
-
_proto.startOf = function startOf(unit) {
|
|
7513
|
+
_proto.startOf = function startOf(unit, _temp3) {
|
|
7514
|
+
var _ref4 = _temp3 === void 0 ? {} : _temp3,
|
|
7515
|
+
_ref4$useLocaleWeeks = _ref4.useLocaleWeeks,
|
|
7516
|
+
useLocaleWeeks = _ref4$useLocaleWeeks === void 0 ? false : _ref4$useLocaleWeeks;
|
|
7107
7517
|
if (!this.isValid) return this;
|
|
7108
7518
|
var o = {},
|
|
7109
7519
|
normalizedUnit = Duration.normalizeUnit(unit);
|
|
@@ -7132,7 +7542,16 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7132
7542
|
}
|
|
7133
7543
|
|
|
7134
7544
|
if (normalizedUnit === "weeks") {
|
|
7135
|
-
|
|
7545
|
+
if (useLocaleWeeks) {
|
|
7546
|
+
var startOfWeek = this.loc.getStartOfWeek();
|
|
7547
|
+
var weekday = this.weekday;
|
|
7548
|
+
if (weekday < startOfWeek) {
|
|
7549
|
+
o.weekNumber = this.weekNumber - 1;
|
|
7550
|
+
}
|
|
7551
|
+
o.weekday = startOfWeek;
|
|
7552
|
+
} else {
|
|
7553
|
+
o.weekday = 1;
|
|
7554
|
+
}
|
|
7136
7555
|
}
|
|
7137
7556
|
if (normalizedUnit === "quarters") {
|
|
7138
7557
|
var q = Math.ceil(this.month / 3);
|
|
@@ -7144,6 +7563,8 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7144
7563
|
/**
|
|
7145
7564
|
* "Set" this DateTime to the end (meaning the last millisecond) of a unit of time
|
|
7146
7565
|
* @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
|
|
7566
|
+
* @param {Object} opts - options
|
|
7567
|
+
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
|
|
7147
7568
|
* @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'
|
|
7148
7569
|
* @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'
|
|
7149
7570
|
* @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays
|
|
@@ -7151,9 +7572,9 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7151
7572
|
* @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'
|
|
7152
7573
|
* @return {DateTime}
|
|
7153
7574
|
*/;
|
|
7154
|
-
_proto.endOf = function endOf(unit) {
|
|
7575
|
+
_proto.endOf = function endOf(unit, opts) {
|
|
7155
7576
|
var _this$plus;
|
|
7156
|
-
return this.isValid ? this.plus((_this$plus = {}, _this$plus[unit] = 1, _this$plus)).startOf(unit).minus(1) : this;
|
|
7577
|
+
return this.isValid ? this.plus((_this$plus = {}, _this$plus[unit] = 1, _this$plus)).startOf(unit, opts).minus(1) : this;
|
|
7157
7578
|
}
|
|
7158
7579
|
|
|
7159
7580
|
// OUTPUT
|
|
@@ -7240,18 +7661,18 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7240
7661
|
* @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
|
|
7241
7662
|
* @return {string}
|
|
7242
7663
|
*/;
|
|
7243
|
-
_proto.toISO = function toISO(
|
|
7244
|
-
var
|
|
7245
|
-
|
|
7246
|
-
format =
|
|
7247
|
-
|
|
7248
|
-
suppressSeconds =
|
|
7249
|
-
|
|
7250
|
-
suppressMilliseconds =
|
|
7251
|
-
|
|
7252
|
-
includeOffset =
|
|
7253
|
-
|
|
7254
|
-
extendedZone =
|
|
7664
|
+
_proto.toISO = function toISO(_temp4) {
|
|
7665
|
+
var _ref5 = _temp4 === void 0 ? {} : _temp4,
|
|
7666
|
+
_ref5$format = _ref5.format,
|
|
7667
|
+
format = _ref5$format === void 0 ? "extended" : _ref5$format,
|
|
7668
|
+
_ref5$suppressSeconds = _ref5.suppressSeconds,
|
|
7669
|
+
suppressSeconds = _ref5$suppressSeconds === void 0 ? false : _ref5$suppressSeconds,
|
|
7670
|
+
_ref5$suppressMillise = _ref5.suppressMilliseconds,
|
|
7671
|
+
suppressMilliseconds = _ref5$suppressMillise === void 0 ? false : _ref5$suppressMillise,
|
|
7672
|
+
_ref5$includeOffset = _ref5.includeOffset,
|
|
7673
|
+
includeOffset = _ref5$includeOffset === void 0 ? true : _ref5$includeOffset,
|
|
7674
|
+
_ref5$extendedZone = _ref5.extendedZone,
|
|
7675
|
+
extendedZone = _ref5$extendedZone === void 0 ? false : _ref5$extendedZone;
|
|
7255
7676
|
if (!this.isValid) {
|
|
7256
7677
|
return null;
|
|
7257
7678
|
}
|
|
@@ -7270,10 +7691,10 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7270
7691
|
* @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'
|
|
7271
7692
|
* @return {string}
|
|
7272
7693
|
*/;
|
|
7273
|
-
_proto.toISODate = function toISODate(
|
|
7274
|
-
var
|
|
7275
|
-
|
|
7276
|
-
format =
|
|
7694
|
+
_proto.toISODate = function toISODate(_temp5) {
|
|
7695
|
+
var _ref6 = _temp5 === void 0 ? {} : _temp5,
|
|
7696
|
+
_ref6$format = _ref6.format,
|
|
7697
|
+
format = _ref6$format === void 0 ? "extended" : _ref6$format;
|
|
7277
7698
|
if (!this.isValid) {
|
|
7278
7699
|
return null;
|
|
7279
7700
|
}
|
|
@@ -7304,20 +7725,20 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7304
7725
|
* @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'
|
|
7305
7726
|
* @return {string}
|
|
7306
7727
|
*/;
|
|
7307
|
-
_proto.toISOTime = function toISOTime(
|
|
7308
|
-
var
|
|
7309
|
-
|
|
7310
|
-
suppressMilliseconds =
|
|
7311
|
-
|
|
7312
|
-
suppressSeconds =
|
|
7313
|
-
|
|
7314
|
-
includeOffset =
|
|
7315
|
-
|
|
7316
|
-
includePrefix =
|
|
7317
|
-
|
|
7318
|
-
extendedZone =
|
|
7319
|
-
|
|
7320
|
-
format =
|
|
7728
|
+
_proto.toISOTime = function toISOTime(_temp6) {
|
|
7729
|
+
var _ref7 = _temp6 === void 0 ? {} : _temp6,
|
|
7730
|
+
_ref7$suppressMillise = _ref7.suppressMilliseconds,
|
|
7731
|
+
suppressMilliseconds = _ref7$suppressMillise === void 0 ? false : _ref7$suppressMillise,
|
|
7732
|
+
_ref7$suppressSeconds = _ref7.suppressSeconds,
|
|
7733
|
+
suppressSeconds = _ref7$suppressSeconds === void 0 ? false : _ref7$suppressSeconds,
|
|
7734
|
+
_ref7$includeOffset = _ref7.includeOffset,
|
|
7735
|
+
includeOffset = _ref7$includeOffset === void 0 ? true : _ref7$includeOffset,
|
|
7736
|
+
_ref7$includePrefix = _ref7.includePrefix,
|
|
7737
|
+
includePrefix = _ref7$includePrefix === void 0 ? false : _ref7$includePrefix,
|
|
7738
|
+
_ref7$extendedZone = _ref7.extendedZone,
|
|
7739
|
+
extendedZone = _ref7$extendedZone === void 0 ? false : _ref7$extendedZone,
|
|
7740
|
+
_ref7$format = _ref7.format,
|
|
7741
|
+
format = _ref7$format === void 0 ? "extended" : _ref7$format;
|
|
7321
7742
|
if (!this.isValid) {
|
|
7322
7743
|
return null;
|
|
7323
7744
|
}
|
|
@@ -7371,14 +7792,14 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7371
7792
|
* @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'
|
|
7372
7793
|
* @return {string}
|
|
7373
7794
|
*/;
|
|
7374
|
-
_proto.toSQLTime = function toSQLTime(
|
|
7375
|
-
var
|
|
7376
|
-
|
|
7377
|
-
includeOffset =
|
|
7378
|
-
|
|
7379
|
-
includeZone =
|
|
7380
|
-
|
|
7381
|
-
includeOffsetSpace =
|
|
7795
|
+
_proto.toSQLTime = function toSQLTime(_temp7) {
|
|
7796
|
+
var _ref8 = _temp7 === void 0 ? {} : _temp7,
|
|
7797
|
+
_ref8$includeOffset = _ref8.includeOffset,
|
|
7798
|
+
includeOffset = _ref8$includeOffset === void 0 ? true : _ref8$includeOffset,
|
|
7799
|
+
_ref8$includeZone = _ref8.includeZone,
|
|
7800
|
+
includeZone = _ref8$includeZone === void 0 ? false : _ref8$includeZone,
|
|
7801
|
+
_ref8$includeOffsetSp = _ref8.includeOffsetSpace,
|
|
7802
|
+
includeOffsetSpace = _ref8$includeOffsetSp === void 0 ? true : _ref8$includeOffsetSp;
|
|
7382
7803
|
var fmt = "HH:mm:ss.SSS";
|
|
7383
7804
|
if (includeZone || includeOffset) {
|
|
7384
7805
|
if (includeOffsetSpace) {
|
|
@@ -7423,6 +7844,18 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7423
7844
|
return this.isValid ? this.toISO() : INVALID;
|
|
7424
7845
|
}
|
|
7425
7846
|
|
|
7847
|
+
/**
|
|
7848
|
+
* Returns a string representation of this DateTime appropriate for the REPL.
|
|
7849
|
+
* @return {string}
|
|
7850
|
+
*/;
|
|
7851
|
+
_proto[_Symbol$for] = function () {
|
|
7852
|
+
if (this.isValid) {
|
|
7853
|
+
return "DateTime { ts: " + this.toISO() + ", zone: " + this.zone.name + ", locale: " + this.locale + " }";
|
|
7854
|
+
} else {
|
|
7855
|
+
return "DateTime { Invalid, reason: " + this.invalidReason + " }";
|
|
7856
|
+
}
|
|
7857
|
+
}
|
|
7858
|
+
|
|
7426
7859
|
/**
|
|
7427
7860
|
* Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis}
|
|
7428
7861
|
* @return {number}
|
|
@@ -7572,16 +8005,18 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7572
8005
|
* 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.
|
|
7573
8006
|
* @param {DateTime} otherDateTime - the other DateTime
|
|
7574
8007
|
* @param {string} unit - the unit of time to check sameness on
|
|
8008
|
+
* @param {Object} opts - options
|
|
8009
|
+
* @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
|
|
7575
8010
|
* @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day
|
|
7576
8011
|
* @return {boolean}
|
|
7577
8012
|
*/;
|
|
7578
|
-
_proto.hasSame = function hasSame(otherDateTime, unit) {
|
|
8013
|
+
_proto.hasSame = function hasSame(otherDateTime, unit, opts) {
|
|
7579
8014
|
if (!this.isValid) return false;
|
|
7580
8015
|
var inputMs = otherDateTime.valueOf();
|
|
7581
8016
|
var adjustedToZone = this.setZone(otherDateTime.zone, {
|
|
7582
8017
|
keepLocalTime: true
|
|
7583
8018
|
});
|
|
7584
|
-
return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit);
|
|
8019
|
+
return adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts);
|
|
7585
8020
|
}
|
|
7586
8021
|
|
|
7587
8022
|
/**
|
|
@@ -7942,6 +8377,51 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
7942
8377
|
return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;
|
|
7943
8378
|
}
|
|
7944
8379
|
|
|
8380
|
+
/**
|
|
8381
|
+
* Returns true if this date is on a weekend according to the locale, false otherwise
|
|
8382
|
+
* @returns {boolean}
|
|
8383
|
+
*/
|
|
8384
|
+
}, {
|
|
8385
|
+
key: "isWeekend",
|
|
8386
|
+
get: function get() {
|
|
8387
|
+
return this.isValid && this.loc.getWeekendDays().includes(this.weekday);
|
|
8388
|
+
}
|
|
8389
|
+
|
|
8390
|
+
/**
|
|
8391
|
+
* Get the day of the week according to the locale.
|
|
8392
|
+
* 1 is the first day of the week and 7 is the last day of the week.
|
|
8393
|
+
* If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1,
|
|
8394
|
+
* @returns {number}
|
|
8395
|
+
*/
|
|
8396
|
+
}, {
|
|
8397
|
+
key: "localWeekday",
|
|
8398
|
+
get: function get() {
|
|
8399
|
+
return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN;
|
|
8400
|
+
}
|
|
8401
|
+
|
|
8402
|
+
/**
|
|
8403
|
+
* Get the week number of the week year according to the locale. Different locales assign week numbers differently,
|
|
8404
|
+
* because the week can start on different days of the week (see localWeekday) and because a different number of days
|
|
8405
|
+
* is required for a week to count as the first week of a year.
|
|
8406
|
+
* @returns {number}
|
|
8407
|
+
*/
|
|
8408
|
+
}, {
|
|
8409
|
+
key: "localWeekNumber",
|
|
8410
|
+
get: function get() {
|
|
8411
|
+
return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN;
|
|
8412
|
+
}
|
|
8413
|
+
|
|
8414
|
+
/**
|
|
8415
|
+
* Get the week year according to the locale. Different locales assign week numbers (and therefor week years)
|
|
8416
|
+
* differently, see localWeekNumber.
|
|
8417
|
+
* @returns {number}
|
|
8418
|
+
*/
|
|
8419
|
+
}, {
|
|
8420
|
+
key: "localWeekYear",
|
|
8421
|
+
get: function get() {
|
|
8422
|
+
return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN;
|
|
8423
|
+
}
|
|
8424
|
+
|
|
7945
8425
|
/**
|
|
7946
8426
|
* Get the ordinal (meaning the day of the year)
|
|
7947
8427
|
* @example DateTime.local(2017, 5, 25).ordinal //=> 145
|
|
@@ -8085,13 +8565,6 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
8085
8565
|
}).offset;
|
|
8086
8566
|
}
|
|
8087
8567
|
}
|
|
8088
|
-
|
|
8089
|
-
/**
|
|
8090
|
-
* Returns true if this DateTime is in a leap year, false otherwise
|
|
8091
|
-
* @example DateTime.local(2016).isInLeapYear //=> true
|
|
8092
|
-
* @example DateTime.local(2013).isInLeapYear //=> false
|
|
8093
|
-
* @type {boolean}
|
|
8094
|
-
*/
|
|
8095
8568
|
}, {
|
|
8096
8569
|
key: "isInLeapYear",
|
|
8097
8570
|
get: function get() {
|
|
@@ -8134,6 +8607,18 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
8134
8607
|
get: function get() {
|
|
8135
8608
|
return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;
|
|
8136
8609
|
}
|
|
8610
|
+
|
|
8611
|
+
/**
|
|
8612
|
+
* Returns the number of weeks in this DateTime's local week year
|
|
8613
|
+
* @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52
|
|
8614
|
+
* @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53
|
|
8615
|
+
* @type {number}
|
|
8616
|
+
*/
|
|
8617
|
+
}, {
|
|
8618
|
+
key: "weeksInLocalWeekYear",
|
|
8619
|
+
get: function get() {
|
|
8620
|
+
return this.isValid ? weeksInWeekYear(this.localWeekYear, this.loc.getMinDaysInFirstWeek(), this.loc.getStartOfWeek()) : NaN;
|
|
8621
|
+
}
|
|
8137
8622
|
}], [{
|
|
8138
8623
|
key: "DATE_SHORT",
|
|
8139
8624
|
get: function get() {
|
|
@@ -8351,7 +8836,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
8351
8836
|
}
|
|
8352
8837
|
}]);
|
|
8353
8838
|
return DateTime;
|
|
8354
|
-
}();
|
|
8839
|
+
}(Symbol.for("nodejs.util.inspect.custom"));
|
|
8355
8840
|
function friendlyDateTime(dateTimeish) {
|
|
8356
8841
|
if (DateTime.isDateTime(dateTimeish)) {
|
|
8357
8842
|
return dateTimeish;
|
|
@@ -8364,7 +8849,7 @@ function friendlyDateTime(dateTimeish) {
|
|
|
8364
8849
|
}
|
|
8365
8850
|
}
|
|
8366
8851
|
|
|
8367
|
-
var VERSION = "3.
|
|
8852
|
+
var VERSION = "3.4.4";
|
|
8368
8853
|
|
|
8369
8854
|
exports.DateTime = DateTime;
|
|
8370
8855
|
exports.Duration = Duration;
|