aboutsummaryrefslogtreecommitdiffstats
path: root/npm_assets/node_modules/luxon/src
diff options
context:
space:
mode:
Diffstat (limited to 'npm_assets/node_modules/luxon/src')
-rw-r--r--npm_assets/node_modules/luxon/src/datetime.js186
-rw-r--r--npm_assets/node_modules/luxon/src/duration.js107
-rw-r--r--npm_assets/node_modules/luxon/src/impl/diff.js1
-rw-r--r--npm_assets/node_modules/luxon/src/impl/english.js18
-rw-r--r--npm_assets/node_modules/luxon/src/impl/formatter.js2
-rw-r--r--npm_assets/node_modules/luxon/src/impl/locale.js39
-rw-r--r--npm_assets/node_modules/luxon/src/impl/regexParser.js34
-rw-r--r--npm_assets/node_modules/luxon/src/impl/util.js12
-rw-r--r--npm_assets/node_modules/luxon/src/info.js25
-rw-r--r--npm_assets/node_modules/luxon/src/interval.js7
-rw-r--r--npm_assets/node_modules/luxon/src/luxon.js3
-rw-r--r--npm_assets/node_modules/luxon/src/zones/IANAZone.js9
-rw-r--r--npm_assets/node_modules/luxon/src/zones/localZone.js2
13 files changed, 316 insertions, 129 deletions
diff --git a/npm_assets/node_modules/luxon/src/datetime.js b/npm_assets/node_modules/luxon/src/datetime.js
index 01532ff..61ef8b4 100644
--- a/npm_assets/node_modules/luxon/src/datetime.js
+++ b/npm_assets/node_modules/luxon/src/datetime.js
@@ -197,6 +197,7 @@ function toTechTimeFormat(
suppressSeconds = false,
suppressMilliseconds = false,
includeOffset,
+ includePrefix = false,
includeZone = false,
spaceZone = false,
format = "extended"
@@ -221,7 +222,13 @@ function toTechTimeFormat(
fmt += format === "basic" ? "ZZZ" : "ZZ";
}
- return toTechFormat(dt, fmt);
+ let str = toTechFormat(dt, fmt);
+
+ if (includePrefix) {
+ str = "T" + str;
+ }
+
+ return str;
}
// defaults for unspecified units in the supported calendars
@@ -353,7 +360,7 @@ function diffRelative(start, end, opts) {
return format(count, unit);
}
}
- return format(0, opts.units[opts.units.length - 1]);
+ return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]);
}
/**
@@ -441,10 +448,21 @@ export default class DateTime {
// CONSTRUCT
/**
+ * Create a DateTime for the current instant, in the system's time zone.
+ *
+ * Use Settings to override these default values if needed.
+ * @example DateTime.now().toISO() //~> now in the ISO format
+ * @return {DateTime}
+ */
+ static now() {
+ return new DateTime({});
+ }
+
+ /**
* Create a local DateTime
* @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used
* @param {number} [month=1] - The month, 1-indexed
- * @param {number} [day=1] - The day of the month
+ * @param {number} [day=1] - The day of the month, 1-indexed
* @param {number} [hour=0] - The hour of the day, in 24-hour time
* @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59
* @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59
@@ -461,7 +479,7 @@ export default class DateTime {
*/
static local(year, month, day, hour, minute, second, millisecond) {
if (isUndefined(year)) {
- return new DateTime({ ts: Settings.now() });
+ return DateTime.now();
} else {
return quickDT(
{
@@ -520,8 +538,8 @@ export default class DateTime {
}
/**
- * Create a DateTime from a Javascript Date object. Uses the default zone.
- * @param {Date} date - a Javascript Date object
+ * Create a DateTime from a JavaScript Date object. Uses the default zone.
+ * @param {Date} date - a JavaScript Date object
* @param {Object} options - configuration options for the DateTime
* @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into
* @return {DateTime}
@@ -594,7 +612,7 @@ export default class DateTime {
}
/**
- * Create a DateTime from a Javascript object with keys like 'year' and 'hour' with reasonable defaults.
+ * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults.
* @param {Object} obj - the object to create the DateTime from
* @param {number} obj.year - a year, such as 1987
* @param {number} obj.month - a month, 1-12
@@ -733,8 +751,8 @@ export default class DateTime {
* @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone
* @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one
* @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance
- * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
- * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance
+ * @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance
+ * @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance
* @example DateTime.fromISO('2016-05-25T09:08:34.123')
* @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00')
* @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true})
@@ -1037,7 +1055,7 @@ export default class DateTime {
/**
* Get the week year
* @see https://en.wikipedia.org/wiki/ISO_week_date
- * @example DateTime.local(2014, 11, 31).weekYear //=> 2015
+ * @example DateTime.local(2014, 12, 31).weekYear //=> 2015
* @type {number}
*/
get weekYear() {
@@ -1081,7 +1099,7 @@ export default class DateTime {
* @type {string}
*/
get monthShort() {
- return this.isValid ? Info.months("short", { locale: this.locale })[this.month - 1] : null;
+ return this.isValid ? Info.months("short", { locObj: this.loc })[this.month - 1] : null;
}
/**
@@ -1091,7 +1109,7 @@ export default class DateTime {
* @type {string}
*/
get monthLong() {
- return this.isValid ? Info.months("long", { locale: this.locale })[this.month - 1] : null;
+ return this.isValid ? Info.months("long", { locObj: this.loc })[this.month - 1] : null;
}
/**
@@ -1101,7 +1119,7 @@ export default class DateTime {
* @type {string}
*/
get weekdayShort() {
- return this.isValid ? Info.weekdays("short", { locale: this.locale })[this.weekday - 1] : null;
+ return this.isValid ? Info.weekdays("short", { locObj: this.loc })[this.weekday - 1] : null;
}
/**
@@ -1111,12 +1129,12 @@ export default class DateTime {
* @type {string}
*/
get weekdayLong() {
- return this.isValid ? Info.weekdays("long", { locale: this.locale })[this.weekday - 1] : null;
+ return this.isValid ? Info.weekdays("long", { locObj: this.loc })[this.weekday - 1] : null;
}
/**
* Get the UTC offset of this DateTime in minutes
- * @example DateTime.local().offset //=> -240
+ * @example DateTime.now().offset //=> -240
* @example DateTime.utc().offset //=> 0
* @type {number}
*/
@@ -1321,7 +1339,22 @@ export default class DateTime {
settingWeekStuff =
!isUndefined(normalized.weekYear) ||
!isUndefined(normalized.weekNumber) ||
- !isUndefined(normalized.weekday);
+ !isUndefined(normalized.weekday),
+ containsOrdinal = !isUndefined(normalized.ordinal),
+ containsGregorYear = !isUndefined(normalized.year),
+ containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),
+ containsGregor = containsGregorYear || containsGregorMD,
+ definiteWeekDef = normalized.weekYear || normalized.weekNumber;
+
+ if ((containsGregor || containsOrdinal) && definiteWeekDef) {
+ throw new ConflictingSpecificationError(
+ "Can't mix weekYear/weekNumber units with year/month/day or ordinals"
+ );
+ }
+
+ if (containsGregorMD && containsOrdinal) {
+ throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");
+ }
let mixed;
if (settingWeekStuff) {
@@ -1347,12 +1380,12 @@ export default class DateTime {
*
* Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between.
* @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
- * @example DateTime.local().plus(123) //~> in 123 milliseconds
- * @example DateTime.local().plus({ minutes: 15 }) //~> in 15 minutes
- * @example DateTime.local().plus({ days: 1 }) //~> this time tomorrow
- * @example DateTime.local().plus({ days: -1 }) //~> this time yesterday
- * @example DateTime.local().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min
- * @example DateTime.local().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min
+ * @example DateTime.now().plus(123) //~> in 123 milliseconds
+ * @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes
+ * @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow
+ * @example DateTime.now().plus({ days: -1 }) //~> this time yesterday
+ * @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min
+ * @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min
* @return {DateTime}
*/
plus(duration) {
@@ -1378,6 +1411,7 @@ export default class DateTime {
* @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
* @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'
* @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'
+ * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays
* @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00'
* @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'
* @return {DateTime}
@@ -1426,9 +1460,10 @@ export default class DateTime {
/**
* "Set" this DateTime to the end (meaning the last millisecond) of a unit of time
- * @param {string} unit - The unit to go to the end of. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'.
+ * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
* @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'
* @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'
+ * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays
* @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00'
* @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'
* @return {DateTime}
@@ -1450,10 +1485,10 @@ export default class DateTime {
* @see https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens
* @param {string} fmt - the format string
* @param {Object} opts - opts to override the configuration options
- * @example DateTime.local().toFormat('yyyy LLL dd') //=> '2017 Apr 22'
- * @example DateTime.local().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22'
- * @example DateTime.local().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22'
- * @example DateTime.local().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes'
+ * @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22'
+ * @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22'
+ * @example DateTime.now().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22'
+ * @example DateTime.now().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes'
* @return {string}
*/
toFormat(fmt, opts = {}) {
@@ -1469,15 +1504,15 @@ export default class DateTime {
* Defaults to the system's locale if no locale has been specified
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
* @param opts {Object} - Intl.DateTimeFormat constructor options and configuration options
- * @example DateTime.local().toLocaleString(); //=> 4/20/2017
- * @example DateTime.local().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'
- * @example DateTime.local().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017'
- * @example DateTime.local().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'
- * @example DateTime.local().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'
- * @example DateTime.local().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'
- * @example DateTime.local().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'
- * @example DateTime.local().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM'
- * @example DateTime.local().toLocaleString({ hour: '2-digit', minute: '2-digit', hour12: false }); //=> '11:32'
+ * @example DateTime.now().toLocaleString(); //=> 4/20/2017
+ * @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'
+ * @example DateTime.now().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017'
+ * @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'
+ * @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'
+ * @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'
+ * @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'
+ * @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM'
+ * @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hour12: false }); //=> '11:32'
* @return {string}
*/
toLocaleString(opts = Formats.DATE_SHORT) {
@@ -1491,7 +1526,7 @@ export default class DateTime {
* Defaults to the system's locale if no locale has been specified
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts
* @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`.
- * @example DateTime.local().toLocaleParts(); //=> [
+ * @example DateTime.now().toLocaleParts(); //=> [
* //=> { type: 'day', value: '25' },
* //=> { type: 'literal', value: '/' },
* //=> { type: 'month', value: '05' },
@@ -1513,9 +1548,9 @@ export default class DateTime {
* @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
* @param {string} [opts.format='extended'] - choose between the basic and extended format
* @example DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
- * @example DateTime.local().toISO() //=> '2017-04-22T20:47:05.335-04:00'
- * @example DateTime.local().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
- * @example DateTime.local().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
+ * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
+ * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
+ * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
* @return {string}
*/
toISO(opts = {}) {
@@ -1558,22 +1593,26 @@ export default class DateTime {
* @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
* @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
* @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
+ * @param {boolean} [opts.includePrefix=false] - include the `T` prefix
* @param {string} [opts.format='extended'] - choose between the basic and extended format
* @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'
* @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'
* @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'
+ * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'
* @return {string}
*/
toISOTime({
suppressMilliseconds = false,
suppressSeconds = false,
includeOffset = true,
+ includePrefix = false,
format = "extended"
} = {}) {
return toTechTimeFormat(this, {
suppressSeconds,
suppressMilliseconds,
includeOffset,
+ includePrefix,
format
});
}
@@ -1615,9 +1654,9 @@ export default class DateTime {
* @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.
* @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
* @example DateTime.utc().toSQL() //=> '05:15:16.345'
- * @example DateTime.local().toSQL() //=> '05:15:16.345 -04:00'
- * @example DateTime.local().toSQL({ includeOffset: false }) //=> '05:15:16.345'
- * @example DateTime.local().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'
+ * @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00'
+ * @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345'
+ * @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'
* @return {string}
*/
toSQLTime({ includeOffset = true, includeZone = false } = {}) {
@@ -1696,10 +1735,10 @@ export default class DateTime {
}
/**
- * Returns a Javascript object with this DateTime's year, month, day, and so on.
+ * Returns a JavaScript object with this DateTime's year, month, day, and so on.
* @param opts - options for generating the object
* @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output
- * @example DateTime.local().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 }
+ * @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 }
* @return {Object}
*/
toObject(opts = {}) {
@@ -1716,7 +1755,7 @@ export default class DateTime {
}
/**
- * Returns a Javascript Date equivalent to this DateTime.
+ * Returns a JavaScript Date equivalent to this DateTime.
* @return {Date}
*/
toJSDate() {
@@ -1771,7 +1810,7 @@ export default class DateTime {
* @return {Duration}
*/
diffNow(unit = "milliseconds", opts = {}) {
- return this.diff(DateTime.local(), unit, opts);
+ return this.diff(DateTime.now(), unit, opts);
}
/**
@@ -1784,20 +1823,20 @@ export default class DateTime {
}
/**
- * Return whether this DateTime is in the same unit of time as another DateTime
+ * Return whether this DateTime is in the same unit of time as another DateTime.
+ * Higher-order units must also be identical for this function to return `true`.
+ * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link setZone} to convert one of the dates if needed.
* @param {DateTime} otherDateTime - the other DateTime
* @param {string} unit - the unit of time to check sameness on
- * @example DateTime.local().hasSame(otherDT, 'day'); //~> true if both the same calendar day
+ * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day
* @return {boolean}
*/
hasSame(otherDateTime, unit) {
if (!this.isValid) return false;
- if (unit === "millisecond") {
- return this.valueOf() === otherDateTime.valueOf();
- } else {
- const inputMs = otherDateTime.valueOf();
- return this.startOf(unit) <= inputMs && inputMs <= this.endOf(unit);
- }
+
+ const inputMs = otherDateTime.valueOf();
+ const otherZoneDateTime = this.setZone(otherDateTime.zone, { keepLocalTime: true });
+ return otherZoneDateTime.startOf(unit) <= inputMs && inputMs <= otherZoneDateTime.endOf(unit);
}
/**
@@ -1821,30 +1860,37 @@ export default class DateTime {
* Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your
* platform supports Intl.RelativeTimeFormat. Rounds down by default.
* @param {Object} options - options that affect the output
- * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now.
+ * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.
* @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow"
- * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds"
+ * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds"
* @param {boolean} [options.round=true] - whether to round the numbers in the output.
- * @param {boolean} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.
+ * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.
* @param {string} options.locale - override the locale of this DateTime
* @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this
- * @example DateTime.local().plus({ days: 1 }).toRelative() //=> "in 1 day"
- * @example DateTime.local().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día"
- * @example DateTime.local().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures"
- * @example DateTime.local().minus({ days: 2 }).toRelative() //=> "2 days ago"
- * @example DateTime.local().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago"
- * @example DateTime.local().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago"
+ * @example DateTime.now().plus({ days: 1 }).toRelative() //=> "in 1 day"
+ * @example DateTime.now().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día"
+ * @example DateTime.now().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures"
+ * @example DateTime.now().minus({ days: 2 }).toRelative() //=> "2 days ago"
+ * @example DateTime.now().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago"
+ * @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago"
*/
toRelative(options = {}) {
if (!this.isValid) return null;
const base = options.base || DateTime.fromObject({ zone: this.zone }),
padding = options.padding ? (this < base ? -options.padding : options.padding) : 0;
+ let units = ["years", "months", "days", "hours", "minutes", "seconds"];
+ let unit = options.unit;
+ if (Array.isArray(options.unit)) {
+ units = options.unit;
+ unit = undefined;
+ }
return diffRelative(
base,
this.plus(padding),
Object.assign(options, {
numeric: "always",
- units: ["years", "months", "days", "hours", "minutes", "seconds"]
+ units,
+ unit
})
);
}
@@ -1853,14 +1899,14 @@ export default class DateTime {
* Returns a string representation of this date relative to today, such as "yesterday" or "next month".
* Only internationalizes on platforms that supports Intl.RelativeTimeFormat.
* @param {Object} options - options that affect the output
- * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now.
+ * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.
* @param {string} options.locale - override the locale of this DateTime
* @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days"
* @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this
- * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow"
- * @example DateTime.local().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana"
- * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain"
- * @example DateTime.local().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago"
+ * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow"
+ * @example DateTime.now().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana"
+ * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain"
+ * @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago"
*/
toRelativeCalendar(options = {}) {
if (!this.isValid) return null;
diff --git a/npm_assets/node_modules/luxon/src/duration.js b/npm_assets/node_modules/luxon/src/duration.js
index 3c6889a..4fcfa4b 100644
--- a/npm_assets/node_modules/luxon/src/duration.js
+++ b/npm_assets/node_modules/luxon/src/duration.js
@@ -2,7 +2,7 @@ import { InvalidArgumentError, InvalidDurationError, InvalidUnitError } from "./
import Formatter from "./impl/formatter.js";
import Invalid from "./impl/invalid.js";
import Locale from "./impl/locale.js";
-import { parseISODuration } from "./impl/regexParser.js";
+import { parseISODuration, parseISOTimeOnly } from "./impl/regexParser.js";
import {
asNumber,
hasOwnProperty,
@@ -216,7 +216,7 @@ export default class Duration {
}
/**
- * Create a Duration from a Javascript object with keys like 'years' and 'hours.
+ * Create a Duration from a JavaScript object with keys like 'years' and 'hours'.
* If this object is empty then a zero milliseconds duration is returned.
* @param {Object} obj - the object to create the DateTime from
* @param {number} obj.years
@@ -277,6 +277,31 @@ export default class Duration {
}
/**
+ * Create a Duration from an ISO 8601 time string.
+ * @param {string} text - text to parse
+ * @param {Object} opts - options for parsing
+ * @param {string} [opts.locale='en-US'] - the locale to use
+ * @param {string} opts.numberingSystem - the numbering system to use
+ * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
+ * @see https://en.wikipedia.org/wiki/ISO_8601#Times
+ * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 }
+ * @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }
+ * @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }
+ * @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }
+ * @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }
+ * @return {Duration}
+ */
+ static fromISOTime(text, opts) {
+ const [parsed] = parseISOTimeOnly(text);
+ if (parsed) {
+ const obj = Object.assign(parsed, opts);
+ return Duration.fromObject(obj);
+ } else {
+ return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
+ }
+ }
+
+ /**
* Create an invalid Duration.
* @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent
* @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information
@@ -383,7 +408,7 @@ export default class Duration {
}
/**
- * Returns a Javascript object with this Duration's values.
+ * Returns a JavaScript object with this Duration's values.
* @param opts - options for generating the object
* @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output
* @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }
@@ -434,6 +459,58 @@ export default class Duration {
}
/**
+ * Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day.
+ * Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours.
+ * @see https://en.wikipedia.org/wiki/ISO_8601#Times
+ * @param {Object} opts - options
+ * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
+ * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
+ * @param {boolean} [opts.includePrefix=false] - include the `T` prefix
+ * @param {string} [opts.format='extended'] - choose between the basic and extended format
+ * @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000'
+ * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00'
+ * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00'
+ * @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000'
+ * @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000'
+ * @return {string}
+ */
+ toISOTime(opts = {}) {
+ if (!this.isValid) return null;
+
+ const millis = this.toMillis();
+ if (millis < 0 || millis >= 86400000) return null;
+
+ opts = Object.assign(
+ {
+ suppressMilliseconds: false,
+ suppressSeconds: false,
+ includePrefix: false,
+ format: "extended"
+ },
+ opts
+ );
+
+ const value = this.shiftTo("hours", "minutes", "seconds", "milliseconds");
+
+ let fmt = opts.format === "basic" ? "hhmm" : "hh:mm";
+
+ if (!opts.suppressSeconds || value.seconds !== 0 || value.milliseconds !== 0) {
+ fmt += opts.format === "basic" ? "ss" : ":ss";
+ if (!opts.suppressMilliseconds || value.milliseconds !== 0) {
+ fmt += ".SSS";
+ }
+ }
+
+ let str = value.toFormat(fmt);
+
+ if (opts.includePrefix) {
+ str = "T" + str;
+ }
+
+ return str;
+ }
+
+ /**
* Returns an ISO 8601 representation of this Duration appropriate for use in JSON.
* @return {string}
*/
@@ -453,11 +530,19 @@ export default class Duration {
* Returns an milliseconds value of this Duration.
* @return {number}
*/
- valueOf() {
+ toMillis() {
return this.as("milliseconds");
}
/**
+ * Returns an milliseconds value of this Duration. Alias of {@link toMillis}
+ * @return {number}
+ */
+ valueOf() {
+ return this.toMillis();
+ }
+
+ /**
* Make this Duration longer by the specified amount. Return a newly-constructed Duration.
* @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
* @return {Duration}
@@ -508,9 +593,9 @@ export default class Duration {
/**
* Get the value of unit.
* @param {string} unit - a unit such as 'minute' or 'day'
- * @example Duration.fromObject({years: 2, days: 3}).years //=> 2
- * @example Duration.fromObject({years: 2, days: 3}).months //=> 0
- * @example Duration.fromObject({years: 2, days: 3}).days //=> 3
+ * @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2
+ * @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0
+ * @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3
* @return {number}
*/
get(unit) {
@@ -762,8 +847,14 @@ export default class Duration {
return false;
}
+ function eq(v1, v2) {
+ // Consider 0 and undefined as equal
+ if (v1 === undefined || v1 === 0) return v2 === undefined || v2 === 0;
+ return v1 === v2;
+ }
+
for (const u of orderedUnits) {
- if (this.values[u] !== other.values[u]) {
+ if (!eq(this.values[u], other.values[u])) {
return false;
}
}
diff --git a/npm_assets/node_modules/luxon/src/impl/diff.js b/npm_assets/node_modules/luxon/src/impl/diff.js
index 57246dc..1b8afb3 100644
--- a/npm_assets/node_modules/luxon/src/impl/diff.js
+++ b/npm_assets/node_modules/luxon/src/impl/diff.js
@@ -13,6 +13,7 @@ function dayDiff(earlier, later) {
function highOrderDiffs(cursor, later, units) {
const differs = [
["years", (a, b) => b.year - a.year],
+ ["quarters", (a, b) => b.quarter - a.quarter],
["months", (a, b) => b.month - a.month + (b.year - a.year) * 12],
[
"weeks",
diff --git a/npm_assets/node_modules/luxon/src/impl/english.js b/npm_assets/node_modules/luxon/src/impl/english.js
index 633f594..0ae2069 100644
--- a/npm_assets/node_modules/luxon/src/impl/english.js
+++ b/npm_assets/node_modules/luxon/src/impl/english.js
@@ -44,11 +44,11 @@ export const monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "
export function months(length) {
switch (length) {
case "narrow":
- return monthsNarrow;
+ return [...monthsNarrow];
case "short":
- return monthsShort;
+ return [...monthsShort];
case "long":
- return monthsLong;
+ return [...monthsLong];
case "numeric":
return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
case "2-digit":
@@ -75,11 +75,11 @@ export const weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"];
export function weekdays(length) {
switch (length) {
case "narrow":
- return weekdaysNarrow;
+ return [...weekdaysNarrow];
case "short":
- return weekdaysShort;
+ return [...weekdaysShort];
case "long":
- return weekdaysLong;
+ return [...weekdaysLong];
case "numeric":
return ["1", "2", "3", "4", "5", "6", "7"];
default:
@@ -98,11 +98,11 @@ export const erasNarrow = ["B", "A"];
export function eras(length) {
switch (length) {
case "narrow":
- return erasNarrow;
+ return [...erasNarrow];
case "short":
- return erasShort;
+ return [...erasShort];
case "long":
- return erasLong;
+ return [...erasLong];
default:
return null;
}
diff --git a/npm_assets/node_modules/luxon/src/impl/formatter.js b/npm_assets/node_modules/luxon/src/impl/formatter.js
index 98872f9..87b8a2f 100644
--- a/npm_assets/node_modules/luxon/src/impl/formatter.js
+++ b/npm_assets/node_modules/luxon/src/impl/formatter.js
@@ -166,7 +166,7 @@ export default class Formatter {
era = length =>
knownEnglish ? English.eraForDateTime(dt, length) : string({ era: length }, "era"),
tokenToString = token => {
- // Where possible: http://cldr.unicode.org/translation/date-time#TOC-Stand-Alone-vs.-Format-Styles
+ // Where possible: http://cldr.unicode.org/translation/date-time-1/date-time#TOC-Standalone-vs.-Format-Styles
switch (token) {
// ms
case "S":
diff --git a/npm_assets/node_modules/luxon/src/impl/locale.js b/npm_assets/node_modules/luxon/src/impl/locale.js
index 0f797b1..44a9266 100644
--- a/npm_assets/node_modules/luxon/src/impl/locale.js
+++ b/npm_assets/node_modules/luxon/src/impl/locale.js
@@ -3,6 +3,7 @@ import * as English from "./english.js";
import Settings from "../settings.js";
import DateTime from "../datetime.js";
import Formatter from "./formatter.js";
+import IANAZone from "../zones/IANAZone.js";
let intlDTCache = {};
function getCachedDTF(locString, opts = {}) {
@@ -183,20 +184,32 @@ class PolyDateFormatter {
let z;
if (dt.zone.universal && this.hasIntl) {
- // Chromium doesn't support fixed-offset zones like Etc/GMT+8 in its formatter,
- // See https://bugs.chromium.org/p/chromium/issues/detail?id=364374.
- // So we have to make do. Two cases:
- // 1. The format options tell us to show the zone. We can't do that, so the best
- // we can do is format the date in UTC.
- // 2. The format options don't tell us to show the zone. Then we can adjust them
- // the time and tell the formatter to show it to us in UTC, so that the time is right
- // and the bad zone doesn't show up.
- // We can clean all this up when Chrome fixes this.
- z = "UTC";
- if (opts.timeZoneName) {
+ // UTC-8 or Etc/UTC-8 are not part of tzdata, only Etc/GMT+8 and the like.
+ // That is why fixed-offset TZ is set to that unless it is:
+ // 1. Representing offset 0 when UTC is used to maintain previous behavior and does not become GMT.
+ // 2. Unsupported by the browser:
+ // - some do not support Etc/
+ // - < Etc/GMT-14, > Etc/GMT+12, and 30-minute or 45-minute offsets are not part of tzdata
+ const gmtOffset = -1 * (dt.offset / 60);
+ const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
+ const isOffsetZoneSupported = IANAZone.isValidZone(offsetZ);
+ if (dt.offset !== 0 && isOffsetZoneSupported) {
+ z = offsetZ;
this.dt = dt;
} else {
- this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000);
+ // Not all fixed-offset zones like Etc/+4:30 are present in tzdata.
+ // So we have to make do. Two cases:
+ // 1. The format options tell us to show the zone. We can't do that, so the best
+ // we can do is format the date in UTC.
+ // 2. The format options don't tell us to show the zone. Then we can adjust them
+ // the time and tell the formatter to show it to us in UTC, so that the time is right
+ // and the bad zone doesn't show up.
+ z = "UTC";
+ if (opts.timeZoneName) {
+ this.dt = dt;
+ } else {
+ this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000);
+ }
}
} else if (dt.zone.type === "local") {
this.dt = dt;
@@ -418,7 +431,7 @@ export default class Locale {
return listStuff(this, length, defaultOK, English.eras, () => {
const intl = { era: length };
- // This is utter bullshit. Different calendars are going to define eras totally differently. What I need is the minimum set of dates
+ // This is problematic. Different calendars are going to define eras totally differently. What I need is the minimum set of dates
// to definitely enumerate them.
if (!this.eraCache[length]) {
this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(dt =>
diff --git a/npm_assets/node_modules/luxon/src/impl/regexParser.js b/npm_assets/node_modules/luxon/src/impl/regexParser.js
index 74ba737..0b0297b 100644
--- a/npm_assets/node_modules/luxon/src/impl/regexParser.js
+++ b/npm_assets/node_modules/luxon/src/impl/regexParser.js
@@ -97,10 +97,10 @@ function extractISOYmd(match, cursor) {
function extractISOTime(match, cursor) {
const item = {
- hour: int(match, cursor, 0),
- minute: int(match, cursor + 1, 0),
- second: int(match, cursor + 2, 0),
- millisecond: parseMillis(match[cursor + 3])
+ hours: int(match, cursor, 0),
+ minutes: int(match, cursor + 1, 0),
+ seconds: int(match, cursor + 2, 0),
+ milliseconds: parseMillis(match[cursor + 3])
};
return [item, null, cursor + 4];
@@ -118,6 +118,10 @@ function extractIANAZone(match, cursor) {
return [{}, zone, cursor + 1];
}
+// ISO time parsing
+
+const isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`);
+
// ISO duration parsing
const isoDuration = /^-?P(?:(?:(-?\d{1,9})Y)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})W)?(?:(-?\d{1,9})D)?(?:T(?:(-?\d{1,9})H)?(?:(-?\d{1,9})M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,9}))?S)?)?)$/;
@@ -136,8 +140,10 @@ function extractISODuration(match) {
] = match;
const hasNegativePrefix = s[0] === "-";
+ const negativeSeconds = secondStr && secondStr[0] === "-";
- const maybeNegate = num => (num && hasNegativePrefix ? -num : num);
+ const maybeNegate = (num, force = false) =>
+ num !== undefined && (force || (num && hasNegativePrefix)) ? -num : num;
return [
{
@@ -147,8 +153,8 @@ function extractISODuration(match) {
days: maybeNegate(parseInteger(dayStr)),
hours: maybeNegate(parseInteger(hourStr)),
minutes: maybeNegate(parseInteger(minuteStr)),
- seconds: maybeNegate(parseInteger(secondStr)),
- milliseconds: maybeNegate(parseMillis(millisecondsStr))
+ seconds: maybeNegate(parseInteger(secondStr), secondStr === "-0"),
+ milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds)
}
];
}
@@ -261,7 +267,11 @@ const extractISOWeekTimeAndOffset = combineExtractors(
extractISOTime,
extractISOOffset
);
-const extractISOOrdinalDataAndTime = combineExtractors(extractISOOrdinalData, extractISOTime);
+const extractISOOrdinalDateAndTime = combineExtractors(
+ extractISOOrdinalData,
+ extractISOTime,
+ extractISOOffset
+);
const extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset);
/**
@@ -273,7 +283,7 @@ export function parseISODate(s) {
s,
[isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],
[isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],
- [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDataAndTime],
+ [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime],
[isoTimeCombinedRegex, extractISOTimeAndOffset]
);
}
@@ -295,6 +305,12 @@ export function parseISODuration(s) {
return parse(s, [isoDuration, extractISODuration]);
}
+const extractISOTimeOnly = combineExtractors(extractISOTime);
+
+export function parseISOTimeOnly(s) {
+ return parse(s, [isoTimeOnly, extractISOTimeOnly]);
+}
+
const sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);
const sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);
diff --git a/npm_assets/node_modules/luxon/src/impl/util.js b/npm_assets/node_modules/luxon/src/impl/util.js
index b345c69..59f6f86 100644
--- a/npm_assets/node_modules/luxon/src/impl/util.js
+++ b/npm_assets/node_modules/luxon/src/impl/util.js
@@ -99,11 +99,17 @@ export function floorMod(x, n) {
}
export function padStart(input, n = 2) {
- if (input.toString().length < n) {
- return ("0".repeat(n) + input).slice(-n);
+ const minus = input < 0 ? "-" : "";
+ const target = minus ? input * -1 : input;
+ let result;
+
+ if (target.toString().length < n) {
+ result = ("0".repeat(n) + target).slice(-n);
} else {
- return input.toString();
+ result = target.toString();
}
+
+ return `${minus}${result}`;
}
export function parseInteger(string) {
diff --git a/npm_assets/node_modules/luxon/src/info.js b/npm_assets/node_modules/luxon/src/info.js
index 52912ac..5197da2 100644
--- a/npm_assets/node_modules/luxon/src/info.js
+++ b/npm_assets/node_modules/luxon/src/info.js
@@ -16,7 +16,7 @@ export default class Info {
* @return {boolean}
*/
static hasDST(zone = Settings.defaultZone) {
- const proto = DateTime.local()
+ const proto = DateTime.now()
.setZone(zone)
.set({ month: 12 });
@@ -57,6 +57,7 @@ export default class Info {
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.numberingSystem=null] - the numbering system
+ * @param {string} [opts.locObj=null] - an existing locale object to use
* @param {string} [opts.outputCalendar='gregory'] - the calendar
* @example Info.months()[0] //=> 'January'
* @example Info.months('short')[0] //=> 'Jan'
@@ -68,9 +69,9 @@ export default class Info {
*/
static months(
length = "long",
- { locale = null, numberingSystem = null, outputCalendar = "gregory" } = {}
+ { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}
) {
- return Locale.create(locale, numberingSystem, outputCalendar).months(length);
+ return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);
}
/**
@@ -82,14 +83,15 @@ export default class Info {
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.numberingSystem=null] - the numbering system
+ * @param {string} [opts.locObj=null] - an existing locale object to use
* @param {string} [opts.outputCalendar='gregory'] - the calendar
* @return {[string]}
*/
static monthsFormat(
length = "long",
- { locale = null, numberingSystem = null, outputCalendar = "gregory" } = {}
+ { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}
) {
- return Locale.create(locale, numberingSystem, outputCalendar).months(length, true);
+ return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);
}
/**
@@ -99,14 +101,15 @@ export default class Info {
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.numberingSystem=null] - the numbering system
+ * @param {string} [opts.locObj=null] - an existing locale object to use
* @example Info.weekdays()[0] //=> 'Monday'
* @example Info.weekdays('short')[0] //=> 'Mon'
* @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'
* @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'
* @return {[string]}
*/
- static weekdays(length = "long", { locale = null, numberingSystem = null } = {}) {
- return Locale.create(locale, numberingSystem, null).weekdays(length);
+ static weekdays(length = "long", { locale = null, numberingSystem = null, locObj = null } = {}) {
+ return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);
}
/**
@@ -118,10 +121,14 @@ export default class Info {
* @param {Object} opts - options
* @param {string} [opts.locale=null] - the locale code
* @param {string} [opts.numberingSystem=null] - the numbering system
+ * @param {string} [opts.locObj=null] - an existing locale object to use
* @return {[string]}
*/
- static weekdaysFormat(length = "long", { locale = null, numberingSystem = null } = {}) {
- return Locale.create(locale, numberingSystem, null).weekdays(length, true);
+ static weekdaysFormat(
+ length = "long",
+ { locale = null, numberingSystem = null, locObj = null } = {}
+ ) {
+ return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);
}
/**
diff --git a/npm_assets/node_modules/luxon/src/interval.js b/npm_assets/node_modules/luxon/src/interval.js
index f2cfce8..71273fd 100644
--- a/npm_assets/node_modules/luxon/src/interval.js
+++ b/npm_assets/node_modules/luxon/src/interval.js
@@ -340,15 +340,16 @@ export default class Interval {
}
let { s } = this,
- added,
+ idx = 1,
next;
const results = [];
while (s < this.e) {
- added = s.plus(dur);
+ const added = this.start.plus(dur.mapUnits(x => x * idx));
next = +added > +this.e ? this.e : added;
results.push(Interval.fromDateTimes(s, next));
s = next;
+ idx += 1;
}
return results;
@@ -428,7 +429,7 @@ export default class Interval {
const s = this.s > other.s ? this.s : other.s,
e = this.e < other.e ? this.e : other.e;
- if (s > e) {
+ if (s >= e) {
return null;
} else {
return Interval.fromDateTimes(s, e);
diff --git a/npm_assets/node_modules/luxon/src/luxon.js b/npm_assets/node_modules/luxon/src/luxon.js
index 31b9738..d391052 100644
--- a/npm_assets/node_modules/luxon/src/luxon.js
+++ b/npm_assets/node_modules/luxon/src/luxon.js
@@ -9,7 +9,10 @@ import InvalidZone from "./zones/invalidZone.js";
import LocalZone from "./zones/localZone.js";
import Settings from "./settings.js";
+const VERSION = "1.28.0";
+
export {
+ VERSION,
DateTime,
Duration,
Interval,
diff --git a/npm_assets/node_modules/luxon/src/zones/IANAZone.js b/npm_assets/node_modules/luxon/src/zones/IANAZone.js
index e2ad296..777958d 100644
--- a/npm_assets/node_modules/luxon/src/zones/IANAZone.js
+++ b/npm_assets/node_modules/luxon/src/zones/IANAZone.js
@@ -109,7 +109,7 @@ export default class IANAZone extends Zone {
/** @ignore */
static parseGMTOffset(specifier) {
if (specifier) {
- const match = specifier.match(/^Etc\/GMT([+-]\d{1,2})$/i);
+ const match = specifier.match(/^Etc\/GMT(0|[+-]\d{1,2})$/i);
if (match) {
return -60 * parseInt(match[1]);
}
@@ -152,8 +152,11 @@ export default class IANAZone extends Zone {
/** @override **/
offset(ts) {
- const date = new Date(ts),
- dtf = makeDTF(this.name),
+ const date = new Date(ts);
+
+ if (isNaN(date)) return NaN;
+
+ const dtf = makeDTF(this.name),
[year, month, day, hour, minute, second] = dtf.formatToParts
? partsOffset(dtf, date)
: hackyOffset(dtf, date),
diff --git a/npm_assets/node_modules/luxon/src/zones/localZone.js b/npm_assets/node_modules/luxon/src/zones/localZone.js
index b8cbcdc..dae9b2a 100644
--- a/npm_assets/node_modules/luxon/src/zones/localZone.js
+++ b/npm_assets/node_modules/luxon/src/zones/localZone.js
@@ -4,7 +4,7 @@ import Zone from "../zone.js";
let singleton = null;
/**
- * Represents the local zone for this Javascript environment.
+ * Represents the local zone for this JavaScript environment.
* @implements {Zone}
*/
export default class LocalZone extends Zone {