@nmshd/consumption 3.6.2 → 3.6.3
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/buildInformation.js +4 -4
- package/dist/modules/attributes/local/LocalAttributeShareInfo.d.ts +3 -7
- package/dist/modules/attributes/local/LocalAttributeShareInfo.js.map +1 -1
- package/lib-web/nmshd.consumption.js +568 -229
- package/lib-web/nmshd.consumption.js.map +1 -1
- package/lib-web/nmshd.consumption.min.js +1 -1
- package/lib-web/nmshd.consumption.min.js.map +1 -1
- package/package.json +3 -3
|
@@ -17,10 +17,10 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
|
17
17
|
const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
|
|
18
18
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
19
19
|
exports.buildInformation = {
|
|
20
|
-
version: "3.6.
|
|
21
|
-
build: "
|
|
22
|
-
date: "2023-11-
|
|
23
|
-
commit: "
|
|
20
|
+
version: "3.6.3",
|
|
21
|
+
build: "117",
|
|
22
|
+
date: "2023-11-13T13:10:20+00:00",
|
|
23
|
+
commit: "e1d5acf9736ab485a497c1e276a0e333bfa05067",
|
|
24
24
|
dependencies: {"@js-soft/docdb-querytranslator":"^1.1.1","@nmshd/iql":"^0.0.4","ts-simple-nameof":"^1.3.1"},
|
|
25
25
|
libraries: {
|
|
26
26
|
transport: transport_1.buildInformation,
|
|
@@ -27543,6 +27543,17 @@ function systemLocale() {
|
|
|
27543
27543
|
return sysLocaleCache;
|
|
27544
27544
|
}
|
|
27545
27545
|
}
|
|
27546
|
+
let weekInfoCache = {};
|
|
27547
|
+
function getCachedWeekInfo(locString) {
|
|
27548
|
+
let data = weekInfoCache[locString];
|
|
27549
|
+
if (!data) {
|
|
27550
|
+
const locale = new Intl.Locale(locString);
|
|
27551
|
+
// browsers currently implement this as a property, but spec says it should be a getter function
|
|
27552
|
+
data = "getWeekInfo" in locale ? locale.getWeekInfo() : locale.weekInfo;
|
|
27553
|
+
weekInfoCache[locString] = data;
|
|
27554
|
+
}
|
|
27555
|
+
return data;
|
|
27556
|
+
}
|
|
27546
27557
|
function parseLocaleString(localeStr) {
|
|
27547
27558
|
// I really want to avoid writing a BCP 47 parser
|
|
27548
27559
|
// see, e.g. https://github.com/wooorm/bcp-47
|
|
@@ -27780,6 +27791,11 @@ class PolyRelFormatter {
|
|
|
27780
27791
|
}
|
|
27781
27792
|
}
|
|
27782
27793
|
}
|
|
27794
|
+
const fallbackWeekSettings = {
|
|
27795
|
+
firstDay: 1,
|
|
27796
|
+
minimalDays: 4,
|
|
27797
|
+
weekend: [6, 7]
|
|
27798
|
+
};
|
|
27783
27799
|
|
|
27784
27800
|
/**
|
|
27785
27801
|
* @private
|
|
@@ -27787,15 +27803,16 @@ class PolyRelFormatter {
|
|
|
27787
27803
|
|
|
27788
27804
|
class Locale {
|
|
27789
27805
|
static fromOpts(opts) {
|
|
27790
|
-
return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN);
|
|
27806
|
+
return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.weekSettings, opts.defaultToEN);
|
|
27791
27807
|
}
|
|
27792
|
-
static create(locale, numberingSystem, outputCalendar, defaultToEN = false) {
|
|
27808
|
+
static create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN = false) {
|
|
27793
27809
|
const specifiedLocale = locale || Settings.defaultLocale;
|
|
27794
27810
|
// the system locale is useful for human readable strings but annoying for parsing/formatting known formats
|
|
27795
27811
|
const localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale());
|
|
27796
27812
|
const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;
|
|
27797
27813
|
const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
|
|
27798
|
-
|
|
27814
|
+
const weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings;
|
|
27815
|
+
return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale);
|
|
27799
27816
|
}
|
|
27800
27817
|
static resetCache() {
|
|
27801
27818
|
sysLocaleCache = null;
|
|
@@ -27806,15 +27823,17 @@ class Locale {
|
|
|
27806
27823
|
static fromObject({
|
|
27807
27824
|
locale,
|
|
27808
27825
|
numberingSystem,
|
|
27809
|
-
outputCalendar
|
|
27826
|
+
outputCalendar,
|
|
27827
|
+
weekSettings
|
|
27810
27828
|
} = {}) {
|
|
27811
|
-
return Locale.create(locale, numberingSystem, outputCalendar);
|
|
27829
|
+
return Locale.create(locale, numberingSystem, outputCalendar, weekSettings);
|
|
27812
27830
|
}
|
|
27813
|
-
constructor(locale, numbering, outputCalendar, specifiedLocale) {
|
|
27831
|
+
constructor(locale, numbering, outputCalendar, weekSettings, specifiedLocale) {
|
|
27814
27832
|
const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);
|
|
27815
27833
|
this.locale = parsedLocale;
|
|
27816
27834
|
this.numberingSystem = numbering || parsedNumberingSystem || null;
|
|
27817
27835
|
this.outputCalendar = outputCalendar || parsedOutputCalendar || null;
|
|
27836
|
+
this.weekSettings = weekSettings;
|
|
27818
27837
|
this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);
|
|
27819
27838
|
this.weekdaysCache = {
|
|
27820
27839
|
format: {},
|
|
@@ -27844,7 +27863,7 @@ class Locale {
|
|
|
27844
27863
|
if (!alts || Object.getOwnPropertyNames(alts).length === 0) {
|
|
27845
27864
|
return this;
|
|
27846
27865
|
} else {
|
|
27847
|
-
return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, alts.defaultToEN || false);
|
|
27866
|
+
return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, validateWeekSettings(alts.weekSettings) || this.weekSettings, alts.defaultToEN || false);
|
|
27848
27867
|
}
|
|
27849
27868
|
}
|
|
27850
27869
|
redefaultToEN(alts = {}) {
|
|
@@ -27942,6 +27961,24 @@ class Locale {
|
|
|
27942
27961
|
isEnglish() {
|
|
27943
27962
|
return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us");
|
|
27944
27963
|
}
|
|
27964
|
+
getWeekSettings() {
|
|
27965
|
+
if (this.weekSettings) {
|
|
27966
|
+
return this.weekSettings;
|
|
27967
|
+
} else if (!hasLocaleWeekInfo()) {
|
|
27968
|
+
return fallbackWeekSettings;
|
|
27969
|
+
} else {
|
|
27970
|
+
return getCachedWeekInfo(this.locale);
|
|
27971
|
+
}
|
|
27972
|
+
}
|
|
27973
|
+
getStartOfWeek() {
|
|
27974
|
+
return this.getWeekSettings().firstDay;
|
|
27975
|
+
}
|
|
27976
|
+
getMinDaysInFirstWeek() {
|
|
27977
|
+
return this.getWeekSettings().minimalDays;
|
|
27978
|
+
}
|
|
27979
|
+
getWeekendDays() {
|
|
27980
|
+
return this.getWeekSettings().weekend;
|
|
27981
|
+
}
|
|
27945
27982
|
equals(other) {
|
|
27946
27983
|
return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar;
|
|
27947
27984
|
}
|
|
@@ -28125,7 +28162,8 @@ let now = () => Date.now(),
|
|
|
28125
28162
|
defaultNumberingSystem = null,
|
|
28126
28163
|
defaultOutputCalendar = null,
|
|
28127
28164
|
twoDigitCutoffYear = 60,
|
|
28128
|
-
throwOnInvalid
|
|
28165
|
+
throwOnInvalid,
|
|
28166
|
+
defaultWeekSettings = null;
|
|
28129
28167
|
|
|
28130
28168
|
/**
|
|
28131
28169
|
* 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.
|
|
@@ -28216,6 +28254,31 @@ class Settings {
|
|
|
28216
28254
|
defaultOutputCalendar = outputCalendar;
|
|
28217
28255
|
}
|
|
28218
28256
|
|
|
28257
|
+
/**
|
|
28258
|
+
* @typedef {Object} WeekSettings
|
|
28259
|
+
* @property {number} firstDay
|
|
28260
|
+
* @property {number} minimalDays
|
|
28261
|
+
* @property {number[]} weekend
|
|
28262
|
+
*/
|
|
28263
|
+
|
|
28264
|
+
/**
|
|
28265
|
+
* @return {WeekSettings|null}
|
|
28266
|
+
*/
|
|
28267
|
+
static get defaultWeekSettings() {
|
|
28268
|
+
return defaultWeekSettings;
|
|
28269
|
+
}
|
|
28270
|
+
|
|
28271
|
+
/**
|
|
28272
|
+
* Allows overriding the default locale week settings, i.e. the start of the week, the weekend and
|
|
28273
|
+
* how many days are required in the first week of a year.
|
|
28274
|
+
* Does not affect existing instances.
|
|
28275
|
+
*
|
|
28276
|
+
* @param {WeekSettings|null} weekSettings
|
|
28277
|
+
*/
|
|
28278
|
+
static set defaultWeekSettings(weekSettings) {
|
|
28279
|
+
defaultWeekSettings = validateWeekSettings(weekSettings);
|
|
28280
|
+
}
|
|
28281
|
+
|
|
28219
28282
|
/**
|
|
28220
28283
|
* Get the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century.
|
|
28221
28284
|
* @type {number}
|
|
@@ -28262,6 +28325,224 @@ class Settings {
|
|
|
28262
28325
|
}
|
|
28263
28326
|
}
|
|
28264
28327
|
|
|
28328
|
+
class Invalid {
|
|
28329
|
+
constructor(reason, explanation) {
|
|
28330
|
+
this.reason = reason;
|
|
28331
|
+
this.explanation = explanation;
|
|
28332
|
+
}
|
|
28333
|
+
toMessage() {
|
|
28334
|
+
if (this.explanation) {
|
|
28335
|
+
return `${this.reason}: ${this.explanation}`;
|
|
28336
|
+
} else {
|
|
28337
|
+
return this.reason;
|
|
28338
|
+
}
|
|
28339
|
+
}
|
|
28340
|
+
}
|
|
28341
|
+
|
|
28342
|
+
const nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
|
|
28343
|
+
leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
|
|
28344
|
+
function unitOutOfRange(unit, value) {
|
|
28345
|
+
return new Invalid("unit out of range", `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`);
|
|
28346
|
+
}
|
|
28347
|
+
function dayOfWeek(year, month, day) {
|
|
28348
|
+
const d = new Date(Date.UTC(year, month - 1, day));
|
|
28349
|
+
if (year < 100 && year >= 0) {
|
|
28350
|
+
d.setUTCFullYear(d.getUTCFullYear() - 1900);
|
|
28351
|
+
}
|
|
28352
|
+
const js = d.getUTCDay();
|
|
28353
|
+
return js === 0 ? 7 : js;
|
|
28354
|
+
}
|
|
28355
|
+
function computeOrdinal(year, month, day) {
|
|
28356
|
+
return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
|
|
28357
|
+
}
|
|
28358
|
+
function uncomputeOrdinal(year, ordinal) {
|
|
28359
|
+
const table = isLeapYear(year) ? leapLadder : nonLeapLadder,
|
|
28360
|
+
month0 = table.findIndex(i => i < ordinal),
|
|
28361
|
+
day = ordinal - table[month0];
|
|
28362
|
+
return {
|
|
28363
|
+
month: month0 + 1,
|
|
28364
|
+
day
|
|
28365
|
+
};
|
|
28366
|
+
}
|
|
28367
|
+
function isoWeekdayToLocal(isoWeekday, startOfWeek) {
|
|
28368
|
+
return (isoWeekday - startOfWeek + 7) % 7 + 1;
|
|
28369
|
+
}
|
|
28370
|
+
|
|
28371
|
+
/**
|
|
28372
|
+
* @private
|
|
28373
|
+
*/
|
|
28374
|
+
|
|
28375
|
+
function gregorianToWeek(gregObj, minDaysInFirstWeek = 4, startOfWeek = 1) {
|
|
28376
|
+
const {
|
|
28377
|
+
year,
|
|
28378
|
+
month,
|
|
28379
|
+
day
|
|
28380
|
+
} = gregObj,
|
|
28381
|
+
ordinal = computeOrdinal(year, month, day),
|
|
28382
|
+
weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek);
|
|
28383
|
+
let weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7),
|
|
28384
|
+
weekYear;
|
|
28385
|
+
if (weekNumber < 1) {
|
|
28386
|
+
weekYear = year - 1;
|
|
28387
|
+
weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek);
|
|
28388
|
+
} else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) {
|
|
28389
|
+
weekYear = year + 1;
|
|
28390
|
+
weekNumber = 1;
|
|
28391
|
+
} else {
|
|
28392
|
+
weekYear = year;
|
|
28393
|
+
}
|
|
28394
|
+
return {
|
|
28395
|
+
weekYear,
|
|
28396
|
+
weekNumber,
|
|
28397
|
+
weekday,
|
|
28398
|
+
...timeObject(gregObj)
|
|
28399
|
+
};
|
|
28400
|
+
}
|
|
28401
|
+
function weekToGregorian(weekData, minDaysInFirstWeek = 4, startOfWeek = 1) {
|
|
28402
|
+
const {
|
|
28403
|
+
weekYear,
|
|
28404
|
+
weekNumber,
|
|
28405
|
+
weekday
|
|
28406
|
+
} = weekData,
|
|
28407
|
+
weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek),
|
|
28408
|
+
yearInDays = daysInYear(weekYear);
|
|
28409
|
+
let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek,
|
|
28410
|
+
year;
|
|
28411
|
+
if (ordinal < 1) {
|
|
28412
|
+
year = weekYear - 1;
|
|
28413
|
+
ordinal += daysInYear(year);
|
|
28414
|
+
} else if (ordinal > yearInDays) {
|
|
28415
|
+
year = weekYear + 1;
|
|
28416
|
+
ordinal -= daysInYear(weekYear);
|
|
28417
|
+
} else {
|
|
28418
|
+
year = weekYear;
|
|
28419
|
+
}
|
|
28420
|
+
const {
|
|
28421
|
+
month,
|
|
28422
|
+
day
|
|
28423
|
+
} = uncomputeOrdinal(year, ordinal);
|
|
28424
|
+
return {
|
|
28425
|
+
year,
|
|
28426
|
+
month,
|
|
28427
|
+
day,
|
|
28428
|
+
...timeObject(weekData)
|
|
28429
|
+
};
|
|
28430
|
+
}
|
|
28431
|
+
function gregorianToOrdinal(gregData) {
|
|
28432
|
+
const {
|
|
28433
|
+
year,
|
|
28434
|
+
month,
|
|
28435
|
+
day
|
|
28436
|
+
} = gregData;
|
|
28437
|
+
const ordinal = computeOrdinal(year, month, day);
|
|
28438
|
+
return {
|
|
28439
|
+
year,
|
|
28440
|
+
ordinal,
|
|
28441
|
+
...timeObject(gregData)
|
|
28442
|
+
};
|
|
28443
|
+
}
|
|
28444
|
+
function ordinalToGregorian(ordinalData) {
|
|
28445
|
+
const {
|
|
28446
|
+
year,
|
|
28447
|
+
ordinal
|
|
28448
|
+
} = ordinalData;
|
|
28449
|
+
const {
|
|
28450
|
+
month,
|
|
28451
|
+
day
|
|
28452
|
+
} = uncomputeOrdinal(year, ordinal);
|
|
28453
|
+
return {
|
|
28454
|
+
year,
|
|
28455
|
+
month,
|
|
28456
|
+
day,
|
|
28457
|
+
...timeObject(ordinalData)
|
|
28458
|
+
};
|
|
28459
|
+
}
|
|
28460
|
+
|
|
28461
|
+
/**
|
|
28462
|
+
* Check if local week units like localWeekday are used in obj.
|
|
28463
|
+
* If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties.
|
|
28464
|
+
* Modifies obj in-place!
|
|
28465
|
+
* @param obj the object values
|
|
28466
|
+
*/
|
|
28467
|
+
function usesLocalWeekValues(obj, loc) {
|
|
28468
|
+
const hasLocaleWeekData = !isUndefined(obj.localWeekday) || !isUndefined(obj.localWeekNumber) || !isUndefined(obj.localWeekYear);
|
|
28469
|
+
if (hasLocaleWeekData) {
|
|
28470
|
+
const hasIsoWeekData = !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear);
|
|
28471
|
+
if (hasIsoWeekData) {
|
|
28472
|
+
throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");
|
|
28473
|
+
}
|
|
28474
|
+
if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday;
|
|
28475
|
+
if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber;
|
|
28476
|
+
if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear;
|
|
28477
|
+
delete obj.localWeekday;
|
|
28478
|
+
delete obj.localWeekNumber;
|
|
28479
|
+
delete obj.localWeekYear;
|
|
28480
|
+
return {
|
|
28481
|
+
minDaysInFirstWeek: loc.getMinDaysInFirstWeek(),
|
|
28482
|
+
startOfWeek: loc.getStartOfWeek()
|
|
28483
|
+
};
|
|
28484
|
+
} else {
|
|
28485
|
+
return {
|
|
28486
|
+
minDaysInFirstWeek: 4,
|
|
28487
|
+
startOfWeek: 1
|
|
28488
|
+
};
|
|
28489
|
+
}
|
|
28490
|
+
}
|
|
28491
|
+
function hasInvalidWeekData(obj, minDaysInFirstWeek = 4, startOfWeek = 1) {
|
|
28492
|
+
const validYear = isInteger(obj.weekYear),
|
|
28493
|
+
validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)),
|
|
28494
|
+
validWeekday = integerBetween(obj.weekday, 1, 7);
|
|
28495
|
+
if (!validYear) {
|
|
28496
|
+
return unitOutOfRange("weekYear", obj.weekYear);
|
|
28497
|
+
} else if (!validWeek) {
|
|
28498
|
+
return unitOutOfRange("week", obj.weekNumber);
|
|
28499
|
+
} else if (!validWeekday) {
|
|
28500
|
+
return unitOutOfRange("weekday", obj.weekday);
|
|
28501
|
+
} else return false;
|
|
28502
|
+
}
|
|
28503
|
+
function hasInvalidOrdinalData(obj) {
|
|
28504
|
+
const validYear = isInteger(obj.year),
|
|
28505
|
+
validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
|
|
28506
|
+
if (!validYear) {
|
|
28507
|
+
return unitOutOfRange("year", obj.year);
|
|
28508
|
+
} else if (!validOrdinal) {
|
|
28509
|
+
return unitOutOfRange("ordinal", obj.ordinal);
|
|
28510
|
+
} else return false;
|
|
28511
|
+
}
|
|
28512
|
+
function hasInvalidGregorianData(obj) {
|
|
28513
|
+
const validYear = isInteger(obj.year),
|
|
28514
|
+
validMonth = integerBetween(obj.month, 1, 12),
|
|
28515
|
+
validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
|
|
28516
|
+
if (!validYear) {
|
|
28517
|
+
return unitOutOfRange("year", obj.year);
|
|
28518
|
+
} else if (!validMonth) {
|
|
28519
|
+
return unitOutOfRange("month", obj.month);
|
|
28520
|
+
} else if (!validDay) {
|
|
28521
|
+
return unitOutOfRange("day", obj.day);
|
|
28522
|
+
} else return false;
|
|
28523
|
+
}
|
|
28524
|
+
function hasInvalidTimeData(obj) {
|
|
28525
|
+
const {
|
|
28526
|
+
hour,
|
|
28527
|
+
minute,
|
|
28528
|
+
second,
|
|
28529
|
+
millisecond
|
|
28530
|
+
} = obj;
|
|
28531
|
+
const validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0,
|
|
28532
|
+
validMinute = integerBetween(minute, 0, 59),
|
|
28533
|
+
validSecond = integerBetween(second, 0, 59),
|
|
28534
|
+
validMillisecond = integerBetween(millisecond, 0, 999);
|
|
28535
|
+
if (!validHour) {
|
|
28536
|
+
return unitOutOfRange("hour", hour);
|
|
28537
|
+
} else if (!validMinute) {
|
|
28538
|
+
return unitOutOfRange("minute", minute);
|
|
28539
|
+
} else if (!validSecond) {
|
|
28540
|
+
return unitOutOfRange("second", second);
|
|
28541
|
+
} else if (!validMillisecond) {
|
|
28542
|
+
return unitOutOfRange("millisecond", millisecond);
|
|
28543
|
+
} else return false;
|
|
28544
|
+
}
|
|
28545
|
+
|
|
28265
28546
|
/*
|
|
28266
28547
|
This is just a junk drawer, containing anything used across multiple classes.
|
|
28267
28548
|
Because Luxon is small(ish), this should stay small and we won't worry about splitting
|
|
@@ -28299,6 +28580,13 @@ function hasRelative() {
|
|
|
28299
28580
|
return false;
|
|
28300
28581
|
}
|
|
28301
28582
|
}
|
|
28583
|
+
function hasLocaleWeekInfo() {
|
|
28584
|
+
try {
|
|
28585
|
+
return typeof Intl !== "undefined" && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype);
|
|
28586
|
+
} catch (e) {
|
|
28587
|
+
return false;
|
|
28588
|
+
}
|
|
28589
|
+
}
|
|
28302
28590
|
|
|
28303
28591
|
// OBJECTS AND ARRAYS
|
|
28304
28592
|
|
|
@@ -28329,6 +28617,22 @@ function pick(obj, keys) {
|
|
|
28329
28617
|
function hasOwnProperty(obj, prop) {
|
|
28330
28618
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
28331
28619
|
}
|
|
28620
|
+
function validateWeekSettings(settings) {
|
|
28621
|
+
if (settings == null) {
|
|
28622
|
+
return null;
|
|
28623
|
+
} else if (typeof settings !== "object") {
|
|
28624
|
+
throw new InvalidArgumentError("Week settings must be an object");
|
|
28625
|
+
} else {
|
|
28626
|
+
if (!integerBetween(settings.firstDay, 1, 7) || !integerBetween(settings.minimalDays, 1, 7) || !Array.isArray(settings.weekend) || settings.weekend.some(v => !integerBetween(v, 1, 7))) {
|
|
28627
|
+
throw new InvalidArgumentError("Invalid week settings");
|
|
28628
|
+
}
|
|
28629
|
+
return {
|
|
28630
|
+
firstDay: settings.firstDay,
|
|
28631
|
+
minimalDays: settings.minimalDays,
|
|
28632
|
+
weekend: Array.from(settings.weekend)
|
|
28633
|
+
};
|
|
28634
|
+
}
|
|
28635
|
+
}
|
|
28332
28636
|
|
|
28333
28637
|
// NUMBERS AND STRINGS
|
|
28334
28638
|
|
|
@@ -28411,11 +28715,16 @@ function objToLocalTS(obj) {
|
|
|
28411
28715
|
}
|
|
28412
28716
|
return +d;
|
|
28413
28717
|
}
|
|
28414
|
-
|
|
28415
|
-
|
|
28416
|
-
|
|
28417
|
-
|
|
28418
|
-
return
|
|
28718
|
+
|
|
28719
|
+
// adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js
|
|
28720
|
+
function firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) {
|
|
28721
|
+
const fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek);
|
|
28722
|
+
return -fwdlw + minDaysInFirstWeek - 1;
|
|
28723
|
+
}
|
|
28724
|
+
function weeksInWeekYear(weekYear, minDaysInFirstWeek = 4, startOfWeek = 1) {
|
|
28725
|
+
const weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek);
|
|
28726
|
+
const weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek);
|
|
28727
|
+
return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7;
|
|
28419
28728
|
}
|
|
28420
28729
|
function untruncateYear(year) {
|
|
28421
28730
|
if (year > 99) {
|
|
@@ -28956,6 +29265,14 @@ class Formatter {
|
|
|
28956
29265
|
return this.num(dt.weekNumber);
|
|
28957
29266
|
case "WW":
|
|
28958
29267
|
return this.num(dt.weekNumber, 2);
|
|
29268
|
+
case "n":
|
|
29269
|
+
return this.num(dt.localWeekNumber);
|
|
29270
|
+
case "nn":
|
|
29271
|
+
return this.num(dt.localWeekNumber, 2);
|
|
29272
|
+
case "ii":
|
|
29273
|
+
return this.num(dt.localWeekYear.toString().slice(-2), 2);
|
|
29274
|
+
case "iiii":
|
|
29275
|
+
return this.num(dt.localWeekYear, 4);
|
|
28959
29276
|
case "o":
|
|
28960
29277
|
return this.num(dt.ordinal);
|
|
28961
29278
|
case "ooo":
|
|
@@ -29017,20 +29334,6 @@ class Formatter {
|
|
|
29017
29334
|
}
|
|
29018
29335
|
}
|
|
29019
29336
|
|
|
29020
|
-
class Invalid {
|
|
29021
|
-
constructor(reason, explanation) {
|
|
29022
|
-
this.reason = reason;
|
|
29023
|
-
this.explanation = explanation;
|
|
29024
|
-
}
|
|
29025
|
-
toMessage() {
|
|
29026
|
-
if (this.explanation) {
|
|
29027
|
-
return `${this.reason}: ${this.explanation}`;
|
|
29028
|
-
} else {
|
|
29029
|
-
return this.reason;
|
|
29030
|
-
}
|
|
29031
|
-
}
|
|
29032
|
-
}
|
|
29033
|
-
|
|
29034
29337
|
/*
|
|
29035
29338
|
* This file handles parsing for well-specified formats. Here's how it works:
|
|
29036
29339
|
* Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.
|
|
@@ -29707,9 +30010,10 @@ class Duration {
|
|
|
29707
30010
|
|
|
29708
30011
|
/**
|
|
29709
30012
|
* Returns a string representation of a Duration with all units included.
|
|
29710
|
-
* To modify its behavior use
|
|
29711
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
|
|
29712
|
-
* @param opts -
|
|
30013
|
+
* To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.
|
|
30014
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
|
|
30015
|
+
* @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.
|
|
30016
|
+
* @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.
|
|
29713
30017
|
* @example
|
|
29714
30018
|
* ```js
|
|
29715
30019
|
* var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
|
|
@@ -29830,6 +30134,18 @@ class Duration {
|
|
|
29830
30134
|
return this.toISO();
|
|
29831
30135
|
}
|
|
29832
30136
|
|
|
30137
|
+
/**
|
|
30138
|
+
* Returns a string representation of this Duration appropriate for the REPL.
|
|
30139
|
+
* @return {string}
|
|
30140
|
+
*/
|
|
30141
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
30142
|
+
if (this.isValid) {
|
|
30143
|
+
return `Duration { values: ${JSON.stringify(this.values)} }`;
|
|
30144
|
+
} else {
|
|
30145
|
+
return `Duration { Invalid, reason: ${this.invalidReason} }`;
|
|
30146
|
+
}
|
|
30147
|
+
}
|
|
30148
|
+
|
|
29833
30149
|
/**
|
|
29834
30150
|
* Returns an milliseconds value of this Duration.
|
|
29835
30151
|
* @return {number}
|
|
@@ -29965,7 +30281,7 @@ class Duration {
|
|
|
29965
30281
|
* Assuming the overall value of the Duration is positive, this means:
|
|
29966
30282
|
* - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example)
|
|
29967
30283
|
* - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise
|
|
29968
|
-
* the overall value would be negative, see
|
|
30284
|
+
* the overall value would be negative, see third example)
|
|
29969
30285
|
* - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example)
|
|
29970
30286
|
*
|
|
29971
30287
|
* If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`.
|
|
@@ -30423,12 +30739,22 @@ class Interval {
|
|
|
30423
30739
|
* Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'
|
|
30424
30740
|
* asks 'what dates are included in this interval?', not 'how many days long is this interval?'
|
|
30425
30741
|
* @param {string} [unit='milliseconds'] - the unit of time to count.
|
|
30742
|
+
* @param {Object} opts - options
|
|
30743
|
+
* @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
|
|
30426
30744
|
* @return {number}
|
|
30427
30745
|
*/
|
|
30428
|
-
count(unit = "milliseconds") {
|
|
30746
|
+
count(unit = "milliseconds", opts) {
|
|
30429
30747
|
if (!this.isValid) return NaN;
|
|
30430
|
-
const start = this.start.startOf(unit)
|
|
30431
|
-
|
|
30748
|
+
const start = this.start.startOf(unit, opts);
|
|
30749
|
+
let end;
|
|
30750
|
+
if (opts != null && opts.useLocaleWeeks) {
|
|
30751
|
+
end = this.end.reconfigure({
|
|
30752
|
+
locale: start.locale
|
|
30753
|
+
});
|
|
30754
|
+
} else {
|
|
30755
|
+
end = this.end;
|
|
30756
|
+
}
|
|
30757
|
+
end = end.startOf(unit, opts);
|
|
30432
30758
|
return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());
|
|
30433
30759
|
}
|
|
30434
30760
|
|
|
@@ -30501,7 +30827,7 @@ class Interval {
|
|
|
30501
30827
|
*/
|
|
30502
30828
|
splitAt(...dateTimes) {
|
|
30503
30829
|
if (!this.isValid) return [];
|
|
30504
|
-
const sorted = dateTimes.map(friendlyDateTime).filter(d => this.contains(d)).sort(),
|
|
30830
|
+
const sorted = dateTimes.map(friendlyDateTime).filter(d => this.contains(d)).sort((a, b) => a.toMillis() - b.toMillis()),
|
|
30505
30831
|
results = [];
|
|
30506
30832
|
let {
|
|
30507
30833
|
s
|
|
@@ -30708,6 +31034,18 @@ class Interval {
|
|
|
30708
31034
|
return `[${this.s.toISO()} – ${this.e.toISO()})`;
|
|
30709
31035
|
}
|
|
30710
31036
|
|
|
31037
|
+
/**
|
|
31038
|
+
* Returns a string representation of this Interval appropriate for the REPL.
|
|
31039
|
+
* @return {string}
|
|
31040
|
+
*/
|
|
31041
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
31042
|
+
if (this.isValid) {
|
|
31043
|
+
return `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`;
|
|
31044
|
+
} else {
|
|
31045
|
+
return `Interval { Invalid, reason: ${this.invalidReason} }`;
|
|
31046
|
+
}
|
|
31047
|
+
}
|
|
31048
|
+
|
|
30711
31049
|
/**
|
|
30712
31050
|
* Returns a localized string representing this Interval. Accepts the same options as the
|
|
30713
31051
|
* Intl.DateTimeFormat constructor and any presets defined by Luxon, such as
|
|
@@ -30858,6 +31196,50 @@ class Info {
|
|
|
30858
31196
|
return normalizeZone(input, Settings.defaultZone);
|
|
30859
31197
|
}
|
|
30860
31198
|
|
|
31199
|
+
/**
|
|
31200
|
+
* Get the weekday on which the week starts according to the given locale.
|
|
31201
|
+
* @param {Object} opts - options
|
|
31202
|
+
* @param {string} [opts.locale] - the locale code
|
|
31203
|
+
* @param {string} [opts.locObj=null] - an existing locale object to use
|
|
31204
|
+
* @returns {number} the start of the week, 1 for Monday through 7 for Sunday
|
|
31205
|
+
*/
|
|
31206
|
+
static getStartOfWeek({
|
|
31207
|
+
locale = null,
|
|
31208
|
+
locObj = null
|
|
31209
|
+
} = {}) {
|
|
31210
|
+
return (locObj || Locale.create(locale)).getStartOfWeek();
|
|
31211
|
+
}
|
|
31212
|
+
|
|
31213
|
+
/**
|
|
31214
|
+
* Get the minimum number of days necessary in a week before it is considered part of the next year according
|
|
31215
|
+
* to the given locale.
|
|
31216
|
+
* @param {Object} opts - options
|
|
31217
|
+
* @param {string} [opts.locale] - the locale code
|
|
31218
|
+
* @param {string} [opts.locObj=null] - an existing locale object to use
|
|
31219
|
+
* @returns {number}
|
|
31220
|
+
*/
|
|
31221
|
+
static getMinimumDaysInFirstWeek({
|
|
31222
|
+
locale = null,
|
|
31223
|
+
locObj = null
|
|
31224
|
+
} = {}) {
|
|
31225
|
+
return (locObj || Locale.create(locale)).getMinDaysInFirstWeek();
|
|
31226
|
+
}
|
|
31227
|
+
|
|
31228
|
+
/**
|
|
31229
|
+
* Get the weekdays, which are considered the weekend according to the given locale
|
|
31230
|
+
* @param {Object} opts - options
|
|
31231
|
+
* @param {string} [opts.locale] - the locale code
|
|
31232
|
+
* @param {string} [opts.locObj=null] - an existing locale object to use
|
|
31233
|
+
* @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday
|
|
31234
|
+
*/
|
|
31235
|
+
static getWeekendWeekdays({
|
|
31236
|
+
locale = null,
|
|
31237
|
+
locObj = null
|
|
31238
|
+
} = {}) {
|
|
31239
|
+
// copy the array, because we cache it internally
|
|
31240
|
+
return (locObj || Locale.create(locale)).getWeekendDays().slice();
|
|
31241
|
+
}
|
|
31242
|
+
|
|
30861
31243
|
/**
|
|
30862
31244
|
* Return an array of standalone month names.
|
|
30863
31245
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
|
|
@@ -30983,12 +31365,14 @@ class Info {
|
|
|
30983
31365
|
* 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.
|
|
30984
31366
|
* Keys:
|
|
30985
31367
|
* * `relative`: whether this environment supports relative time formatting
|
|
30986
|
-
*
|
|
31368
|
+
* * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale
|
|
31369
|
+
* @example Info.features() //=> { relative: false, localeWeek: true }
|
|
30987
31370
|
* @return {Object}
|
|
30988
31371
|
*/
|
|
30989
31372
|
static features() {
|
|
30990
31373
|
return {
|
|
30991
|
-
relative: hasRelative()
|
|
31374
|
+
relative: hasRelative(),
|
|
31375
|
+
localeWeek: hasLocaleWeekInfo()
|
|
30992
31376
|
};
|
|
30993
31377
|
}
|
|
30994
31378
|
}
|
|
@@ -31592,176 +31976,6 @@ function formatOptsToTokens(formatOpts, locale) {
|
|
|
31592
31976
|
return parts.map(p => tokenForPart(p, formatOpts, resolvedOpts));
|
|
31593
31977
|
}
|
|
31594
31978
|
|
|
31595
|
-
const nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
|
|
31596
|
-
leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
|
|
31597
|
-
function unitOutOfRange(unit, value) {
|
|
31598
|
-
return new Invalid("unit out of range", `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`);
|
|
31599
|
-
}
|
|
31600
|
-
function dayOfWeek(year, month, day) {
|
|
31601
|
-
const d = new Date(Date.UTC(year, month - 1, day));
|
|
31602
|
-
if (year < 100 && year >= 0) {
|
|
31603
|
-
d.setUTCFullYear(d.getUTCFullYear() - 1900);
|
|
31604
|
-
}
|
|
31605
|
-
const js = d.getUTCDay();
|
|
31606
|
-
return js === 0 ? 7 : js;
|
|
31607
|
-
}
|
|
31608
|
-
function computeOrdinal(year, month, day) {
|
|
31609
|
-
return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
|
|
31610
|
-
}
|
|
31611
|
-
function uncomputeOrdinal(year, ordinal) {
|
|
31612
|
-
const table = isLeapYear(year) ? leapLadder : nonLeapLadder,
|
|
31613
|
-
month0 = table.findIndex(i => i < ordinal),
|
|
31614
|
-
day = ordinal - table[month0];
|
|
31615
|
-
return {
|
|
31616
|
-
month: month0 + 1,
|
|
31617
|
-
day
|
|
31618
|
-
};
|
|
31619
|
-
}
|
|
31620
|
-
|
|
31621
|
-
/**
|
|
31622
|
-
* @private
|
|
31623
|
-
*/
|
|
31624
|
-
|
|
31625
|
-
function gregorianToWeek(gregObj) {
|
|
31626
|
-
const {
|
|
31627
|
-
year,
|
|
31628
|
-
month,
|
|
31629
|
-
day
|
|
31630
|
-
} = gregObj,
|
|
31631
|
-
ordinal = computeOrdinal(year, month, day),
|
|
31632
|
-
weekday = dayOfWeek(year, month, day);
|
|
31633
|
-
let weekNumber = Math.floor((ordinal - weekday + 10) / 7),
|
|
31634
|
-
weekYear;
|
|
31635
|
-
if (weekNumber < 1) {
|
|
31636
|
-
weekYear = year - 1;
|
|
31637
|
-
weekNumber = weeksInWeekYear(weekYear);
|
|
31638
|
-
} else if (weekNumber > weeksInWeekYear(year)) {
|
|
31639
|
-
weekYear = year + 1;
|
|
31640
|
-
weekNumber = 1;
|
|
31641
|
-
} else {
|
|
31642
|
-
weekYear = year;
|
|
31643
|
-
}
|
|
31644
|
-
return {
|
|
31645
|
-
weekYear,
|
|
31646
|
-
weekNumber,
|
|
31647
|
-
weekday,
|
|
31648
|
-
...timeObject(gregObj)
|
|
31649
|
-
};
|
|
31650
|
-
}
|
|
31651
|
-
function weekToGregorian(weekData) {
|
|
31652
|
-
const {
|
|
31653
|
-
weekYear,
|
|
31654
|
-
weekNumber,
|
|
31655
|
-
weekday
|
|
31656
|
-
} = weekData,
|
|
31657
|
-
weekdayOfJan4 = dayOfWeek(weekYear, 1, 4),
|
|
31658
|
-
yearInDays = daysInYear(weekYear);
|
|
31659
|
-
let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3,
|
|
31660
|
-
year;
|
|
31661
|
-
if (ordinal < 1) {
|
|
31662
|
-
year = weekYear - 1;
|
|
31663
|
-
ordinal += daysInYear(year);
|
|
31664
|
-
} else if (ordinal > yearInDays) {
|
|
31665
|
-
year = weekYear + 1;
|
|
31666
|
-
ordinal -= daysInYear(weekYear);
|
|
31667
|
-
} else {
|
|
31668
|
-
year = weekYear;
|
|
31669
|
-
}
|
|
31670
|
-
const {
|
|
31671
|
-
month,
|
|
31672
|
-
day
|
|
31673
|
-
} = uncomputeOrdinal(year, ordinal);
|
|
31674
|
-
return {
|
|
31675
|
-
year,
|
|
31676
|
-
month,
|
|
31677
|
-
day,
|
|
31678
|
-
...timeObject(weekData)
|
|
31679
|
-
};
|
|
31680
|
-
}
|
|
31681
|
-
function gregorianToOrdinal(gregData) {
|
|
31682
|
-
const {
|
|
31683
|
-
year,
|
|
31684
|
-
month,
|
|
31685
|
-
day
|
|
31686
|
-
} = gregData;
|
|
31687
|
-
const ordinal = computeOrdinal(year, month, day);
|
|
31688
|
-
return {
|
|
31689
|
-
year,
|
|
31690
|
-
ordinal,
|
|
31691
|
-
...timeObject(gregData)
|
|
31692
|
-
};
|
|
31693
|
-
}
|
|
31694
|
-
function ordinalToGregorian(ordinalData) {
|
|
31695
|
-
const {
|
|
31696
|
-
year,
|
|
31697
|
-
ordinal
|
|
31698
|
-
} = ordinalData;
|
|
31699
|
-
const {
|
|
31700
|
-
month,
|
|
31701
|
-
day
|
|
31702
|
-
} = uncomputeOrdinal(year, ordinal);
|
|
31703
|
-
return {
|
|
31704
|
-
year,
|
|
31705
|
-
month,
|
|
31706
|
-
day,
|
|
31707
|
-
...timeObject(ordinalData)
|
|
31708
|
-
};
|
|
31709
|
-
}
|
|
31710
|
-
function hasInvalidWeekData(obj) {
|
|
31711
|
-
const validYear = isInteger(obj.weekYear),
|
|
31712
|
-
validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)),
|
|
31713
|
-
validWeekday = integerBetween(obj.weekday, 1, 7);
|
|
31714
|
-
if (!validYear) {
|
|
31715
|
-
return unitOutOfRange("weekYear", obj.weekYear);
|
|
31716
|
-
} else if (!validWeek) {
|
|
31717
|
-
return unitOutOfRange("week", obj.week);
|
|
31718
|
-
} else if (!validWeekday) {
|
|
31719
|
-
return unitOutOfRange("weekday", obj.weekday);
|
|
31720
|
-
} else return false;
|
|
31721
|
-
}
|
|
31722
|
-
function hasInvalidOrdinalData(obj) {
|
|
31723
|
-
const validYear = isInteger(obj.year),
|
|
31724
|
-
validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
|
|
31725
|
-
if (!validYear) {
|
|
31726
|
-
return unitOutOfRange("year", obj.year);
|
|
31727
|
-
} else if (!validOrdinal) {
|
|
31728
|
-
return unitOutOfRange("ordinal", obj.ordinal);
|
|
31729
|
-
} else return false;
|
|
31730
|
-
}
|
|
31731
|
-
function hasInvalidGregorianData(obj) {
|
|
31732
|
-
const validYear = isInteger(obj.year),
|
|
31733
|
-
validMonth = integerBetween(obj.month, 1, 12),
|
|
31734
|
-
validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
|
|
31735
|
-
if (!validYear) {
|
|
31736
|
-
return unitOutOfRange("year", obj.year);
|
|
31737
|
-
} else if (!validMonth) {
|
|
31738
|
-
return unitOutOfRange("month", obj.month);
|
|
31739
|
-
} else if (!validDay) {
|
|
31740
|
-
return unitOutOfRange("day", obj.day);
|
|
31741
|
-
} else return false;
|
|
31742
|
-
}
|
|
31743
|
-
function hasInvalidTimeData(obj) {
|
|
31744
|
-
const {
|
|
31745
|
-
hour,
|
|
31746
|
-
minute,
|
|
31747
|
-
second,
|
|
31748
|
-
millisecond
|
|
31749
|
-
} = obj;
|
|
31750
|
-
const validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0,
|
|
31751
|
-
validMinute = integerBetween(minute, 0, 59),
|
|
31752
|
-
validSecond = integerBetween(second, 0, 59),
|
|
31753
|
-
validMillisecond = integerBetween(millisecond, 0, 999);
|
|
31754
|
-
if (!validHour) {
|
|
31755
|
-
return unitOutOfRange("hour", hour);
|
|
31756
|
-
} else if (!validMinute) {
|
|
31757
|
-
return unitOutOfRange("minute", minute);
|
|
31758
|
-
} else if (!validSecond) {
|
|
31759
|
-
return unitOutOfRange("second", second);
|
|
31760
|
-
} else if (!validMillisecond) {
|
|
31761
|
-
return unitOutOfRange("millisecond", millisecond);
|
|
31762
|
-
} else return false;
|
|
31763
|
-
}
|
|
31764
|
-
|
|
31765
31979
|
const INVALID = "Invalid DateTime";
|
|
31766
31980
|
const MAX_DATE = 8.64e15;
|
|
31767
31981
|
function unsupportedZone(zone) {
|
|
@@ -31769,6 +31983,9 @@ function unsupportedZone(zone) {
|
|
|
31769
31983
|
}
|
|
31770
31984
|
|
|
31771
31985
|
// we cache week data on the DT object and this intermediates the cache
|
|
31986
|
+
/**
|
|
31987
|
+
* @param {DateTime} dt
|
|
31988
|
+
*/
|
|
31772
31989
|
function possiblyCachedWeekData(dt) {
|
|
31773
31990
|
if (dt.weekData === null) {
|
|
31774
31991
|
dt.weekData = gregorianToWeek(dt.c);
|
|
@@ -31776,6 +31993,16 @@ function possiblyCachedWeekData(dt) {
|
|
|
31776
31993
|
return dt.weekData;
|
|
31777
31994
|
}
|
|
31778
31995
|
|
|
31996
|
+
/**
|
|
31997
|
+
* @param {DateTime} dt
|
|
31998
|
+
*/
|
|
31999
|
+
function possiblyCachedLocalWeekData(dt) {
|
|
32000
|
+
if (dt.localWeekData === null) {
|
|
32001
|
+
dt.localWeekData = gregorianToWeek(dt.c, dt.loc.getMinDaysInFirstWeek(), dt.loc.getStartOfWeek());
|
|
32002
|
+
}
|
|
32003
|
+
return dt.localWeekData;
|
|
32004
|
+
}
|
|
32005
|
+
|
|
31779
32006
|
// clone really means, "make a new object with these modifications". all "setters" really use this
|
|
31780
32007
|
// to create a new object while only changing some of the properties
|
|
31781
32008
|
function clone(inst, alts) {
|
|
@@ -32020,6 +32247,21 @@ function normalizeUnit(unit) {
|
|
|
32020
32247
|
if (!normalized) throw new InvalidUnitError(unit);
|
|
32021
32248
|
return normalized;
|
|
32022
32249
|
}
|
|
32250
|
+
function normalizeUnitWithLocalWeeks(unit) {
|
|
32251
|
+
switch (unit.toLowerCase()) {
|
|
32252
|
+
case "localweekday":
|
|
32253
|
+
case "localweekdays":
|
|
32254
|
+
return "localWeekday";
|
|
32255
|
+
case "localweeknumber":
|
|
32256
|
+
case "localweeknumbers":
|
|
32257
|
+
return "localWeekNumber";
|
|
32258
|
+
case "localweekyear":
|
|
32259
|
+
case "localweekyears":
|
|
32260
|
+
return "localWeekYear";
|
|
32261
|
+
default:
|
|
32262
|
+
return normalizeUnit(unit);
|
|
32263
|
+
}
|
|
32264
|
+
}
|
|
32023
32265
|
|
|
32024
32266
|
// this is a dumbed down version of fromObject() that runs about 60% faster
|
|
32025
32267
|
// but doesn't do any validation, makes a bunch of assumptions about what units
|
|
@@ -32154,6 +32396,10 @@ class DateTime {
|
|
|
32154
32396
|
* @access private
|
|
32155
32397
|
*/
|
|
32156
32398
|
this.weekData = null;
|
|
32399
|
+
/**
|
|
32400
|
+
* @access private
|
|
32401
|
+
*/
|
|
32402
|
+
this.localWeekData = null;
|
|
32157
32403
|
/**
|
|
32158
32404
|
* @access private
|
|
32159
32405
|
*/
|
|
@@ -32335,13 +32581,16 @@ class DateTime {
|
|
|
32335
32581
|
* @param {number} obj.weekYear - an ISO week year
|
|
32336
32582
|
* @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year
|
|
32337
32583
|
* @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday
|
|
32584
|
+
* @param {number} obj.localWeekYear - a week year, according to the locale
|
|
32585
|
+
* @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale
|
|
32586
|
+
* @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
|
|
32338
32587
|
* @param {number} obj.hour - hour of the day, 0-23
|
|
32339
32588
|
* @param {number} obj.minute - minute of the hour, 0-59
|
|
32340
32589
|
* @param {number} obj.second - second of the minute, 0-59
|
|
32341
32590
|
* @param {number} obj.millisecond - millisecond of the second, 0-999
|
|
32342
32591
|
* @param {Object} opts - options for creating this DateTime
|
|
32343
32592
|
* @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()
|
|
32344
|
-
* @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance
|
|
32593
|
+
* @param {string} [opts.locale='system\'s locale'] - a locale to set on the resulting DateTime instance
|
|
32345
32594
|
* @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
|
|
32346
32595
|
* @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance
|
|
32347
32596
|
* @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'
|
|
@@ -32351,6 +32600,7 @@ class DateTime {
|
|
|
32351
32600
|
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' })
|
|
32352
32601
|
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' })
|
|
32353
32602
|
* @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'
|
|
32603
|
+
* @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: "en-US" }).toISODate() //=> '2021-12-26'
|
|
32354
32604
|
* @return {DateTime}
|
|
32355
32605
|
*/
|
|
32356
32606
|
static fromObject(obj, opts = {}) {
|
|
@@ -32359,15 +32609,19 @@ class DateTime {
|
|
|
32359
32609
|
if (!zoneToUse.isValid) {
|
|
32360
32610
|
return DateTime.invalid(unsupportedZone(zoneToUse));
|
|
32361
32611
|
}
|
|
32612
|
+
const loc = Locale.fromObject(opts);
|
|
32613
|
+
const normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);
|
|
32614
|
+
const {
|
|
32615
|
+
minDaysInFirstWeek,
|
|
32616
|
+
startOfWeek
|
|
32617
|
+
} = usesLocalWeekValues(normalized, loc);
|
|
32362
32618
|
const tsNow = Settings.now(),
|
|
32363
32619
|
offsetProvis = !isUndefined(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow),
|
|
32364
|
-
normalized = normalizeObject(obj, normalizeUnit),
|
|
32365
32620
|
containsOrdinal = !isUndefined(normalized.ordinal),
|
|
32366
32621
|
containsGregorYear = !isUndefined(normalized.year),
|
|
32367
32622
|
containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),
|
|
32368
32623
|
containsGregor = containsGregorYear || containsGregorMD,
|
|
32369
|
-
definiteWeekDef = normalized.weekYear || normalized.weekNumber
|
|
32370
|
-
loc = Locale.fromObject(opts);
|
|
32624
|
+
definiteWeekDef = normalized.weekYear || normalized.weekNumber;
|
|
32371
32625
|
|
|
32372
32626
|
// cases:
|
|
32373
32627
|
// just a weekday -> this week's instance of that weekday, no worries
|
|
@@ -32390,7 +32644,7 @@ class DateTime {
|
|
|
32390
32644
|
if (useWeekData) {
|
|
32391
32645
|
units = orderedWeekUnits;
|
|
32392
32646
|
defaultValues = defaultWeekUnitValues;
|
|
32393
|
-
objNow = gregorianToWeek(objNow);
|
|
32647
|
+
objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek);
|
|
32394
32648
|
} else if (containsOrdinal) {
|
|
32395
32649
|
units = orderedOrdinalUnits;
|
|
32396
32650
|
defaultValues = defaultOrdinalUnitValues;
|
|
@@ -32414,14 +32668,14 @@ class DateTime {
|
|
|
32414
32668
|
}
|
|
32415
32669
|
|
|
32416
32670
|
// make sure the values we have are in range
|
|
32417
|
-
const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized),
|
|
32671
|
+
const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized),
|
|
32418
32672
|
invalid = higherOrderInvalid || hasInvalidTimeData(normalized);
|
|
32419
32673
|
if (invalid) {
|
|
32420
32674
|
return DateTime.invalid(invalid);
|
|
32421
32675
|
}
|
|
32422
32676
|
|
|
32423
32677
|
// compute the actual time
|
|
32424
|
-
const gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized,
|
|
32678
|
+
const gregorian = useWeekData ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? ordinalToGregorian(normalized) : normalized,
|
|
32425
32679
|
[tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse),
|
|
32426
32680
|
inst = new DateTime({
|
|
32427
32681
|
ts: tsFinal,
|
|
@@ -32800,6 +33054,43 @@ class DateTime {
|
|
|
32800
33054
|
return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;
|
|
32801
33055
|
}
|
|
32802
33056
|
|
|
33057
|
+
/**
|
|
33058
|
+
* Returns true if this date is on a weekend according to the locale, false otherwise
|
|
33059
|
+
* @returns {boolean}
|
|
33060
|
+
*/
|
|
33061
|
+
get isWeekend() {
|
|
33062
|
+
return this.isValid && this.loc.getWeekendDays().includes(this.weekday);
|
|
33063
|
+
}
|
|
33064
|
+
|
|
33065
|
+
/**
|
|
33066
|
+
* Get the day of the week according to the locale.
|
|
33067
|
+
* 1 is the first day of the week and 7 is the last day of the week.
|
|
33068
|
+
* If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1,
|
|
33069
|
+
* @returns {number}
|
|
33070
|
+
*/
|
|
33071
|
+
get localWeekday() {
|
|
33072
|
+
return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN;
|
|
33073
|
+
}
|
|
33074
|
+
|
|
33075
|
+
/**
|
|
33076
|
+
* Get the week number of the week year according to the locale. Different locales assign week numbers differently,
|
|
33077
|
+
* because the week can start on different days of the week (see localWeekday) and because a different number of days
|
|
33078
|
+
* is required for a week to count as the first week of a year.
|
|
33079
|
+
* @returns {number}
|
|
33080
|
+
*/
|
|
33081
|
+
get localWeekNumber() {
|
|
33082
|
+
return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN;
|
|
33083
|
+
}
|
|
33084
|
+
|
|
33085
|
+
/**
|
|
33086
|
+
* Get the week year according to the locale. Different locales assign week numbers (and therefor week years)
|
|
33087
|
+
* differently, see localWeekNumber.
|
|
33088
|
+
* @returns {number}
|
|
33089
|
+
*/
|
|
33090
|
+
get localWeekYear() {
|
|
33091
|
+
return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN;
|
|
33092
|
+
}
|
|
33093
|
+
|
|
32803
33094
|
/**
|
|
32804
33095
|
* Get the ordinal (meaning the day of the year)
|
|
32805
33096
|
* @example DateTime.local(2017, 5, 25).ordinal //=> 145
|
|
@@ -33000,6 +33291,16 @@ class DateTime {
|
|
|
33000
33291
|
return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;
|
|
33001
33292
|
}
|
|
33002
33293
|
|
|
33294
|
+
/**
|
|
33295
|
+
* Returns the number of weeks in this DateTime's local week year
|
|
33296
|
+
* @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52
|
|
33297
|
+
* @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53
|
|
33298
|
+
* @type {number}
|
|
33299
|
+
*/
|
|
33300
|
+
get weeksInLocalWeekYear() {
|
|
33301
|
+
return this.isValid ? weeksInWeekYear(this.localWeekYear, this.loc.getMinDaysInFirstWeek(), this.loc.getStartOfWeek()) : NaN;
|
|
33302
|
+
}
|
|
33303
|
+
|
|
33003
33304
|
/**
|
|
33004
33305
|
* Returns the resolved Intl options for this DateTime.
|
|
33005
33306
|
* This is useful in understanding the behavior of formatting methods
|
|
@@ -33111,6 +33412,9 @@ class DateTime {
|
|
|
33111
33412
|
/**
|
|
33112
33413
|
* "Set" the values of specified units. Returns a newly-constructed DateTime.
|
|
33113
33414
|
* You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}.
|
|
33415
|
+
*
|
|
33416
|
+
* This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`.
|
|
33417
|
+
* They cannot be mixed with ISO-week units like `weekday`.
|
|
33114
33418
|
* @param {Object} values - a mapping of units to numbers
|
|
33115
33419
|
* @example dt.set({ year: 2017 })
|
|
33116
33420
|
* @example dt.set({ hour: 8, minute: 30 })
|
|
@@ -33120,8 +33424,12 @@ class DateTime {
|
|
|
33120
33424
|
*/
|
|
33121
33425
|
set(values) {
|
|
33122
33426
|
if (!this.isValid) return this;
|
|
33123
|
-
const normalized = normalizeObject(values,
|
|
33124
|
-
|
|
33427
|
+
const normalized = normalizeObject(values, normalizeUnitWithLocalWeeks);
|
|
33428
|
+
const {
|
|
33429
|
+
minDaysInFirstWeek,
|
|
33430
|
+
startOfWeek
|
|
33431
|
+
} = usesLocalWeekValues(normalized, this.loc);
|
|
33432
|
+
const settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday),
|
|
33125
33433
|
containsOrdinal = !isUndefined(normalized.ordinal),
|
|
33126
33434
|
containsGregorYear = !isUndefined(normalized.year),
|
|
33127
33435
|
containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),
|
|
@@ -33136,9 +33444,9 @@ class DateTime {
|
|
|
33136
33444
|
let mixed;
|
|
33137
33445
|
if (settingWeekStuff) {
|
|
33138
33446
|
mixed = weekToGregorian({
|
|
33139
|
-
...gregorianToWeek(this.c),
|
|
33447
|
+
...gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek),
|
|
33140
33448
|
...normalized
|
|
33141
|
-
});
|
|
33449
|
+
}, minDaysInFirstWeek, startOfWeek);
|
|
33142
33450
|
} else if (!isUndefined(normalized.ordinal)) {
|
|
33143
33451
|
mixed = ordinalToGregorian({
|
|
33144
33452
|
...gregorianToOrdinal(this.c),
|
|
@@ -33197,6 +33505,8 @@ class DateTime {
|
|
|
33197
33505
|
/**
|
|
33198
33506
|
* "Set" this DateTime to the beginning of a unit of time.
|
|
33199
33507
|
* @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
|
|
33508
|
+
* @param {Object} opts - options
|
|
33509
|
+
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
|
|
33200
33510
|
* @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'
|
|
33201
33511
|
* @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'
|
|
33202
33512
|
* @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays
|
|
@@ -33204,7 +33514,9 @@ class DateTime {
|
|
|
33204
33514
|
* @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'
|
|
33205
33515
|
* @return {DateTime}
|
|
33206
33516
|
*/
|
|
33207
|
-
startOf(unit
|
|
33517
|
+
startOf(unit, {
|
|
33518
|
+
useLocaleWeeks = false
|
|
33519
|
+
} = {}) {
|
|
33208
33520
|
if (!this.isValid) return this;
|
|
33209
33521
|
const o = {},
|
|
33210
33522
|
normalizedUnit = Duration.normalizeUnit(unit);
|
|
@@ -33233,7 +33545,18 @@ class DateTime {
|
|
|
33233
33545
|
}
|
|
33234
33546
|
|
|
33235
33547
|
if (normalizedUnit === "weeks") {
|
|
33236
|
-
|
|
33548
|
+
if (useLocaleWeeks) {
|
|
33549
|
+
const startOfWeek = this.loc.getStartOfWeek();
|
|
33550
|
+
const {
|
|
33551
|
+
weekday
|
|
33552
|
+
} = this;
|
|
33553
|
+
if (weekday < startOfWeek) {
|
|
33554
|
+
o.weekNumber = this.weekNumber - 1;
|
|
33555
|
+
}
|
|
33556
|
+
o.weekday = startOfWeek;
|
|
33557
|
+
} else {
|
|
33558
|
+
o.weekday = 1;
|
|
33559
|
+
}
|
|
33237
33560
|
}
|
|
33238
33561
|
if (normalizedUnit === "quarters") {
|
|
33239
33562
|
const q = Math.ceil(this.month / 3);
|
|
@@ -33245,6 +33568,8 @@ class DateTime {
|
|
|
33245
33568
|
/**
|
|
33246
33569
|
* "Set" this DateTime to the end (meaning the last millisecond) of a unit of time
|
|
33247
33570
|
* @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
|
|
33571
|
+
* @param {Object} opts - options
|
|
33572
|
+
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
|
|
33248
33573
|
* @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'
|
|
33249
33574
|
* @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'
|
|
33250
33575
|
* @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays
|
|
@@ -33252,10 +33577,10 @@ class DateTime {
|
|
|
33252
33577
|
* @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'
|
|
33253
33578
|
* @return {DateTime}
|
|
33254
33579
|
*/
|
|
33255
|
-
endOf(unit) {
|
|
33580
|
+
endOf(unit, opts) {
|
|
33256
33581
|
return this.isValid ? this.plus({
|
|
33257
33582
|
[unit]: 1
|
|
33258
|
-
}).startOf(unit).minus(1) : this;
|
|
33583
|
+
}).startOf(unit, opts).minus(1) : this;
|
|
33259
33584
|
}
|
|
33260
33585
|
|
|
33261
33586
|
// OUTPUT
|
|
@@ -33495,6 +33820,18 @@ class DateTime {
|
|
|
33495
33820
|
return this.isValid ? this.toISO() : INVALID;
|
|
33496
33821
|
}
|
|
33497
33822
|
|
|
33823
|
+
/**
|
|
33824
|
+
* Returns a string representation of this DateTime appropriate for the REPL.
|
|
33825
|
+
* @return {string}
|
|
33826
|
+
*/
|
|
33827
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
33828
|
+
if (this.isValid) {
|
|
33829
|
+
return `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`;
|
|
33830
|
+
} else {
|
|
33831
|
+
return `DateTime { Invalid, reason: ${this.invalidReason} }`;
|
|
33832
|
+
}
|
|
33833
|
+
}
|
|
33834
|
+
|
|
33498
33835
|
/**
|
|
33499
33836
|
* Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis}
|
|
33500
33837
|
* @return {number}
|
|
@@ -33632,16 +33969,18 @@ class DateTime {
|
|
|
33632
33969
|
* 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.
|
|
33633
33970
|
* @param {DateTime} otherDateTime - the other DateTime
|
|
33634
33971
|
* @param {string} unit - the unit of time to check sameness on
|
|
33972
|
+
* @param {Object} opts - options
|
|
33973
|
+
* @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
|
|
33635
33974
|
* @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day
|
|
33636
33975
|
* @return {boolean}
|
|
33637
33976
|
*/
|
|
33638
|
-
hasSame(otherDateTime, unit) {
|
|
33977
|
+
hasSame(otherDateTime, unit, opts) {
|
|
33639
33978
|
if (!this.isValid) return false;
|
|
33640
33979
|
const inputMs = otherDateTime.valueOf();
|
|
33641
33980
|
const adjustedToZone = this.setZone(otherDateTime.zone, {
|
|
33642
33981
|
keepLocalTime: true
|
|
33643
33982
|
});
|
|
33644
|
-
return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit);
|
|
33983
|
+
return adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts);
|
|
33645
33984
|
}
|
|
33646
33985
|
|
|
33647
33986
|
/**
|
|
@@ -33965,7 +34304,7 @@ function friendlyDateTime(dateTimeish) {
|
|
|
33965
34304
|
}
|
|
33966
34305
|
}
|
|
33967
34306
|
|
|
33968
|
-
const VERSION = "3.4.
|
|
34307
|
+
const VERSION = "3.4.4";
|
|
33969
34308
|
|
|
33970
34309
|
exports.DateTime = DateTime;
|
|
33971
34310
|
exports.Duration = Duration;
|