diff options
| author | 2024-04-23 00:38:24 -0400 | |
|---|---|---|
| committer | 2024-04-23 00:38:24 -0400 | |
| commit | 0199f695e93782d728bd31857afe54f4df92f351 (patch) | |
| tree | 34e9030a05a89461d222172615c74891fba1e5ef /npm_assets/node_modules/luxon/src/datetime.js | |
| parent | 22b8f5dae59e876643e8e3002f72282f3e8608c5 (diff) | |
| parent | 9b0e86a8e74768c4fe848fb5ce8d754292db4e3e (diff) | |
Update upstream source from tag 'upstream/8.3.0'
Update to upstream version '8.3.0'
with Debian dir bc13791b86ab63e4473e92288f1749c55a6ad540
Diffstat (limited to 'npm_assets/node_modules/luxon/src/datetime.js')
| -rw-r--r-- | npm_assets/node_modules/luxon/src/datetime.js | 635 |
1 files changed, 357 insertions, 278 deletions
diff --git a/npm_assets/node_modules/luxon/src/datetime.js b/npm_assets/node_modules/luxon/src/datetime.js index 61ef8b4..5120b05 100644 --- a/npm_assets/node_modules/luxon/src/datetime.js +++ b/npm_assets/node_modules/luxon/src/datetime.js @@ -1,4 +1,4 @@ -import Duration, { friendlyDuration } from "./duration.js"; +import Duration from "./duration.js"; import Interval from "./interval.js"; import Settings from "./settings.js"; import Info from "./info.js"; @@ -17,12 +17,18 @@ import { weeksInWeekYear, normalizeObject, roundTo, - objToLocalTS + objToLocalTS, + padStart, } from "./impl/util.js"; import { normalizeZone } from "./impl/zoneUtil.js"; import diff from "./impl/diff.js"; import { parseRFC2822Date, parseISODate, parseHTTPDate, parseSQL } from "./impl/regexParser.js"; -import { parseFromTokens, explainFromTokens } from "./impl/tokenParser.js"; +import { + parseFromTokens, + explainFromTokens, + formatOptsToTokens, + expandMacroTokens, +} from "./impl/tokenParser.js"; import { gregorianToWeek, weekToGregorian, @@ -31,14 +37,14 @@ import { hasInvalidGregorianData, hasInvalidWeekData, hasInvalidOrdinalData, - hasInvalidTimeData + hasInvalidTimeData, } from "./impl/conversions.js"; import * as Formats from "./impl/formats.js"; import { InvalidArgumentError, ConflictingSpecificationError, InvalidUnitError, - InvalidDateTimeError + InvalidDateTimeError, } from "./errors.js"; import Invalid from "./impl/invalid.js"; @@ -66,9 +72,9 @@ function clone(inst, alts) { c: inst.c, o: inst.o, loc: inst.loc, - invalid: inst.invalid + invalid: inst.invalid, }; - return new DateTime(Object.assign({}, current, alts, { old: current })); + return new DateTime({ ...current, ...alts, old: current }); } // find the right offset a given local time. The o input is our guess, which determines which @@ -111,7 +117,7 @@ function tsToObj(ts, offset) { hour: d.getUTCHours(), minute: d.getUTCMinutes(), second: d.getUTCSeconds(), - millisecond: d.getUTCMilliseconds() + millisecond: d.getUTCMilliseconds(), }; } @@ -125,14 +131,15 @@ function adjustTime(inst, dur) { const oPre = inst.o, year = inst.c.year + Math.trunc(dur.years), month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3, - c = Object.assign({}, inst.c, { + c = { + ...inst.c, year, month, day: Math.min(inst.c.day, daysInMonth(year, month)) + Math.trunc(dur.days) + - Math.trunc(dur.weeks) * 7 - }), + Math.trunc(dur.weeks) * 7, + }, millisToAdd = Duration.fromObject({ years: dur.years - Math.trunc(dur.years), quarters: dur.quarters - Math.trunc(dur.quarters), @@ -142,7 +149,7 @@ function adjustTime(inst, dur) { hours: dur.hours, minutes: dur.minutes, seconds: dur.seconds, - milliseconds: dur.milliseconds + milliseconds: dur.milliseconds, }).as("milliseconds"), localTS = objToLocalTS(c); @@ -159,17 +166,15 @@ function adjustTime(inst, dur) { // helper useful in turning the results of parsing into real dates // by handling the zone options -function parseDataToDateTime(parsed, parsedZone, opts, format, text) { +function parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) { const { setZone, zone } = opts; - if (parsed && Object.keys(parsed).length !== 0) { + if ((parsed && Object.keys(parsed).length !== 0) || parsedZone) { const interpretationZone = parsedZone || zone, - inst = DateTime.fromObject( - Object.assign(parsed, opts, { - zone: interpretationZone, - // setZone is a valid option in the calling methods, but not in fromObject - setZone: undefined - }) - ); + inst = DateTime.fromObject(parsed, { + ...opts, + zone: interpretationZone, + specificOffset, + }); return setZone ? inst : inst.setZone(zone); } else { return DateTime.invalid( @@ -184,51 +189,77 @@ function toTechFormat(dt, format, allowZ = true) { return dt.isValid ? Formatter.create(Locale.create("en-US"), { allowZ, - forceSimple: true + forceSimple: true, }).formatDateTimeFromString(dt, format) : null; } -// technical time formats (e.g. the time part of ISO 8601), take some options -// and this commonizes their handling -function toTechTimeFormat( - dt, - { - suppressSeconds = false, - suppressMilliseconds = false, - includeOffset, - includePrefix = false, - includeZone = false, - spaceZone = false, - format = "extended" +function toISODate(o, extended) { + const longFormat = o.c.year > 9999 || o.c.year < 0; + let c = ""; + if (longFormat && o.c.year >= 0) c += "+"; + c += padStart(o.c.year, longFormat ? 6 : 4); + + if (extended) { + c += "-"; + c += padStart(o.c.month); + c += "-"; + c += padStart(o.c.day); + } else { + c += padStart(o.c.month); + c += padStart(o.c.day); } -) { - let fmt = format === "basic" ? "HHmm" : "HH:mm"; + return c; +} - if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) { - fmt += format === "basic" ? "ss" : ":ss"; - if (!suppressMilliseconds || dt.millisecond !== 0) { - fmt += ".SSS"; +function toISOTime( + o, + extended, + suppressSeconds, + suppressMilliseconds, + includeOffset, + extendedZone +) { + let c = padStart(o.c.hour); + if (extended) { + c += ":"; + c += padStart(o.c.minute); + if (o.c.second !== 0 || !suppressSeconds) { + c += ":"; } + } else { + c += padStart(o.c.minute); } - if ((includeZone || includeOffset) && spaceZone) { - fmt += " "; - } + if (o.c.second !== 0 || !suppressSeconds) { + c += padStart(o.c.second); - if (includeZone) { - fmt += "z"; - } else if (includeOffset) { - fmt += format === "basic" ? "ZZZ" : "ZZ"; + if (o.c.millisecond !== 0 || !suppressMilliseconds) { + c += "."; + c += padStart(o.c.millisecond, 3); + } } - let str = toTechFormat(dt, fmt); - - if (includePrefix) { - str = "T" + str; + if (includeOffset) { + if (o.isOffsetFixed && o.offset === 0 && !extendedZone) { + c += "Z"; + } else if (o.o < 0) { + c += "-"; + c += padStart(Math.trunc(-o.o / 60)); + c += ":"; + c += padStart(Math.trunc(-o.o % 60)); + } else { + c += "+"; + c += padStart(Math.trunc(o.o / 60)); + c += ":"; + c += padStart(Math.trunc(o.o % 60)); + } } - return str; + if (extendedZone) { + c += "[" + o.zone.ianaName + "]"; + } + return c; } // defaults for unspecified units in the supported calendars @@ -238,7 +269,7 @@ const defaultUnitValues = { hour: 0, minute: 0, second: 0, - millisecond: 0 + millisecond: 0, }, defaultWeekUnitValues = { weekNumber: 1, @@ -246,14 +277,14 @@ const defaultUnitValues = { hour: 0, minute: 0, second: 0, - millisecond: 0 + millisecond: 0, }, defaultOrdinalUnitValues = { ordinal: 1, hour: 0, minute: 0, second: 0, - millisecond: 0 + millisecond: 0, }; // Units in the supported calendars, sorted by bigness @@ -265,7 +296,7 @@ const orderedUnits = ["year", "month", "day", "hour", "minute", "second", "milli "hour", "minute", "second", - "millisecond" + "millisecond", ], orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"]; @@ -295,7 +326,7 @@ function normalizeUnit(unit) { weeknumbers: "weekNumber", weekyear: "weekYear", weekyears: "weekYear", - ordinal: "ordinal" + ordinal: "ordinal", }[unit.toLowerCase()]; if (!normalized) throw new InvalidUnitError(unit); @@ -306,28 +337,33 @@ function normalizeUnit(unit) { // this is a dumbed down version of fromObject() that runs about 60% faster // but doesn't do any validation, makes a bunch of assumptions about what units // are present, and so on. -function quickDT(obj, zone) { +function quickDT(obj, opts) { + const zone = normalizeZone(opts.zone, Settings.defaultZone), + loc = Locale.fromObject(opts), + tsNow = Settings.now(); + + let ts, o; + // assume we have the higher-order units - for (const u of orderedUnits) { - if (isUndefined(obj[u])) { - obj[u] = defaultUnitValues[u]; + if (!isUndefined(obj.year)) { + for (const u of orderedUnits) { + if (isUndefined(obj[u])) { + obj[u] = defaultUnitValues[u]; + } } - } - const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj); - if (invalid) { - return DateTime.invalid(invalid); - } + const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj); + if (invalid) { + return DateTime.invalid(invalid); + } - const tsNow = Settings.now(), - offsetProvis = zone.offset(tsNow), + const offsetProvis = zone.offset(tsNow); [ts, o] = objToTS(obj, offsetProvis, zone); + } else { + ts = tsNow; + } - return new DateTime({ - ts, - zone, - o - }); + return new DateTime({ ts, zone, loc, o }); } function diffRelative(start, end, opts) { @@ -337,13 +373,10 @@ function diffRelative(start, end, opts) { const formatter = end.loc.clone(opts).relFormatter(opts); return formatter.format(c, unit); }, - differ = unit => { + differ = (unit) => { if (opts.calendary) { if (!end.hasSame(start, unit)) { - return end - .startOf(unit) - .diff(start.startOf(unit), unit) - .get(unit); + return end.startOf(unit).diff(start.startOf(unit), unit).get(unit); } else return 0; } else { return end.diff(start, unit).get(unit); @@ -363,6 +396,18 @@ function diffRelative(start, end, opts) { return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]); } +function lastOpts(argList) { + let opts = {}, + args; + if (argList.length > 0 && typeof argList[argList.length - 1] === "object") { + opts = argList[argList.length - 1]; + args = Array.from(argList).slice(0, argList.length - 1); + } else { + args = Array.from(argList); + } + return [opts, args]; +} + /** * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them. * @@ -373,13 +418,13 @@ function diffRelative(start, end, opts) { * * Here is a brief overview of the most commonly used functionality it provides: * - * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link local}, {@link utc}, and (most flexibly) {@link fromObject}. To create one from a standard string format, use {@link fromISO}, {@link fromHTTP}, and {@link fromRFC2822}. To create one from a custom string format, use {@link fromFormat}. To create one from a native JS date, use {@link fromJSDate}. - * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link toObject}), use the {@link year}, {@link month}, - * {@link day}, {@link hour}, {@link minute}, {@link second}, {@link millisecond} accessors. - * * **Week calendar**: For ISO week calendar attributes, see the {@link weekYear}, {@link weekNumber}, and {@link weekday} accessors. - * * **Configuration** See the {@link locale} and {@link numberingSystem} accessors. - * * **Transformation**: To transform the DateTime into other DateTimes, use {@link set}, {@link reconfigure}, {@link setZone}, {@link setLocale}, {@link plus}, {@link minus}, {@link endOf}, {@link startOf}, {@link toUTC}, and {@link toLocal}. - * * **Output**: To convert the DateTime to other representations, use the {@link toRelative}, {@link toRelativeCalendar}, {@link toJSON}, {@link toISO}, {@link toHTTP}, {@link toObject}, {@link toRFC2822}, {@link toString}, {@link toLocaleString}, {@link toFormat}, {@link toMillis} and {@link toJSDate}. + * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime.local}, {@link DateTime.utc}, and (most flexibly) {@link DateTime.fromObject}. To create one from a standard string format, use {@link DateTime.fromISO}, {@link DateTime.fromHTTP}, and {@link DateTime.fromRFC2822}. To create one from a custom string format, use {@link DateTime.fromFormat}. To create one from a native JS date, use {@link DateTime.fromJSDate}. + * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link DateTime#toObject}), use the {@link DateTime#year}, {@link DateTime#month}, + * {@link DateTime#day}, {@link DateTime#hour}, {@link DateTime#minute}, {@link DateTime#second}, {@link DateTime#millisecond} accessors. + * * **Week calendar**: For ISO week calendar attributes, see the {@link DateTime#weekYear}, {@link DateTime#weekNumber}, and {@link DateTime#weekday} accessors. + * * **Configuration** See the {@link DateTime#locale} and {@link DateTime#numberingSystem} accessors. + * * **Transformation**: To transform the DateTime into other DateTimes, use {@link DateTime#set}, {@link DateTime#reconfigure}, {@link DateTime#setZone}, {@link DateTime#setLocale}, {@link DateTime.plus}, {@link DateTime#minus}, {@link DateTime#endOf}, {@link DateTime#startOf}, {@link DateTime#toUTC}, and {@link DateTime#toLocal}. + * * **Output**: To convert the DateTime to other representations, use the {@link DateTime#toRelative}, {@link DateTime#toRelativeCalendar}, {@link DateTime#toJSON}, {@link DateTime#toISO}, {@link DateTime#toHTTP}, {@link DateTime#toObject}, {@link DateTime#toRFC2822}, {@link DateTime#toString}, {@link DateTime#toLocaleString}, {@link DateTime#toFormat}, {@link DateTime#toMillis} and {@link DateTime#toJSDate}. * * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation. */ @@ -467,33 +512,22 @@ export default class DateTime { * @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 * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 - * @example DateTime.local() //~> now - * @example DateTime.local(2017) //~> 2017-01-01T00:00:00 - * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 - * @example DateTime.local(2017, 3, 12) //~> 2017-03-12T00:00:00 - * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 - * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 - * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 - * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 + * @example DateTime.local() //~> now + * @example DateTime.local({ zone: "America/New_York" }) //~> now, in US east coast time + * @example DateTime.local(2017) //~> 2017-01-01T00:00:00 + * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 + * @example DateTime.local(2017, 3, 12, { locale: "fr" }) //~> 2017-03-12T00:00:00, with a French locale + * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 + * @example DateTime.local(2017, 3, 12, 5, { zone: "utc" }) //~> 2017-03-12T05:00:00, in UTC + * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 + * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 + * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 * @return {DateTime} */ - static local(year, month, day, hour, minute, second, millisecond) { - if (isUndefined(year)) { - return DateTime.now(); - } else { - return quickDT( - { - year, - month, - day, - hour, - minute, - second, - millisecond - }, - Settings.defaultZone - ); - } + static local() { + const [opts, args] = lastOpts(arguments), + [year, month, day, hour, minute, second, millisecond] = args; + return quickDT({ year, month, day, hour, minute, second, millisecond }, opts); } /** @@ -505,36 +539,27 @@ export default class DateTime { * @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 * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 - * @example DateTime.utc() //~> now - * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z - * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z - * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z - * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z - * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z - * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z - * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765Z + * @param {Object} options - configuration options for the DateTime + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance + * @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance + * @example DateTime.utc() //~> now + * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z + * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z + * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z + * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45, { locale: "fr" }) //~> 2017-03-12T05:45:00Z with a French locale + * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: "fr" }) //~> 2017-03-12T05:45:10.765Z with a French locale * @return {DateTime} */ - static utc(year, month, day, hour, minute, second, millisecond) { - if (isUndefined(year)) { - return new DateTime({ - ts: Settings.now(), - zone: FixedOffsetZone.utcInstance - }); - } else { - return quickDT( - { - year, - month, - day, - hour, - minute, - second, - millisecond - }, - FixedOffsetZone.utcInstance - ); - } + static utc() { + const [opts, args] = lastOpts(arguments), + [year, month, day, hour, minute, second, millisecond] = args; + + opts.zone = FixedOffsetZone.utcInstance; + return quickDT({ year, month, day, hour, minute, second, millisecond }, opts); } /** @@ -558,7 +583,7 @@ export default class DateTime { return new DateTime({ ts: ts, zone: zoneToUse, - loc: Locale.fromObject(options) + loc: Locale.fromObject(options), }); } @@ -584,7 +609,7 @@ export default class DateTime { return new DateTime({ ts: milliseconds, zone: normalizeZone(options.zone, Settings.defaultZone), - loc: Locale.fromObject(options) + loc: Locale.fromObject(options), }); } } @@ -606,7 +631,7 @@ export default class DateTime { return new DateTime({ ts: seconds * 1000, zone: normalizeZone(options.zone, Settings.defaultZone), - loc: Locale.fromObject(options) + loc: Locale.fromObject(options), }); } } @@ -625,39 +650,38 @@ export default class DateTime { * @param {number} obj.minute - minute of the hour, 0-59 * @param {number} obj.second - second of the minute, 0-59 * @param {number} obj.millisecond - millisecond of the second, 0-999 - * @param {string|Zone} [obj.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone() - * @param {string} [obj.locale='system's locale'] - a locale to set on the resulting DateTime instance - * @param {string} obj.outputCalendar - the output calendar to set on the resulting DateTime instance - * @param {string} obj.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {Object} opts - options for creating this DateTime + * @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() + * @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 * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25' * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01' * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06 - * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'utc' }), - * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'local' }) - * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'America/New_York' }) + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }), + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' }) + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' }) * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13' * @return {DateTime} */ - static fromObject(obj) { - const zoneToUse = normalizeZone(obj.zone, Settings.defaultZone); + static fromObject(obj, opts = {}) { + obj = obj || {}; + const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone); if (!zoneToUse.isValid) { return DateTime.invalid(unsupportedZone(zoneToUse)); } const tsNow = Settings.now(), - offsetProvis = zoneToUse.offset(tsNow), - normalized = normalizeObject(obj, normalizeUnit, [ - "zone", - "locale", - "outputCalendar", - "numberingSystem" - ]), + offsetProvis = !isUndefined(opts.specificOffset) + ? opts.specificOffset + : zoneToUse.offset(tsNow), + normalized = normalizeObject(obj, normalizeUnit), containsOrdinal = !isUndefined(normalized.ordinal), containsGregorYear = !isUndefined(normalized.year), containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber, - loc = Locale.fromObject(obj); + loc = Locale.fromObject(opts); // cases: // just a weekday -> this week's instance of that weekday, no worries @@ -711,8 +735,8 @@ export default class DateTime { const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal - ? hasInvalidOrdinalData(normalized) - : hasInvalidGregorianData(normalized), + ? hasInvalidOrdinalData(normalized) + : hasInvalidGregorianData(normalized), invalid = higherOrderInvalid || hasInvalidTimeData(normalized); if (invalid) { @@ -723,14 +747,14 @@ export default class DateTime { const gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal - ? ordinalToGregorian(normalized) - : normalized, + ? ordinalToGregorian(normalized) + : normalized, [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse), inst = new DateTime({ ts: tsFinal, zone: zoneToUse, o: offsetFinal, - loc + loc, }); // gregorian data + weekday serves only to validate @@ -806,8 +830,7 @@ export default class DateTime { /** * Create a DateTime from an input string and format string. - * Defaults to en-US if no locale has been specified, regardless of the system's locale. - * @see https://moment.github.io/luxon/docs/manual/parsing.html#table-of-tokens + * Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens). * @param {string} text - the string to parse * @param {string} fmt - the format the string is expected to be in (see the link below for the formats) * @param {Object} opts - options to affect the creation @@ -827,13 +850,13 @@ export default class DateTime { localeToUse = Locale.fromOpts({ locale, numberingSystem, - defaultToEN: true + defaultToEN: true, }), - [vals, parsedZone, invalid] = parseFromTokens(localeToUse, text, fmt); + [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt); if (invalid) { return DateTime.invalid(invalid); } else { - return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text); + return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset); } } @@ -871,7 +894,7 @@ export default class DateTime { /** * Create an invalid DateTime. - * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent + * @param {DateTime} 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 * @return {DateTime} */ @@ -890,7 +913,7 @@ export default class DateTime { } /** - * Check if an object is a DateTime. Works across context boundaries + * Check if an object is an instance of DateTime. Works across context boundaries * @param {object} o * @return {boolean} */ @@ -898,6 +921,29 @@ export default class DateTime { return (o && o.isLuxonDateTime) || false; } + /** + * Produce the format string for a set of options + * @param formatOpts + * @param localeOpts + * @returns {string} + */ + static parseFormatForOpts(formatOpts, localeOpts = {}) { + const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts)); + return !tokenList ? null : tokenList.map((t) => (t ? t.val : null)).join(""); + } + + /** + * Produce the the fully expanded format token for the locale + * Does NOT quote characters, so quoted tokens will not round trip correctly + * @param fmt + * @param localeOpts + * @returns {string} + */ + static expandFormat(fmt, localeOpts = {}) { + const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts)); + return expanded.map((t) => t.val).join(""); + } + // INFO /** @@ -1151,7 +1197,7 @@ export default class DateTime { if (this.isValid) { return this.zone.offsetName(this.ts, { format: "short", - locale: this.locale + locale: this.locale, }); } else { return null; @@ -1167,7 +1213,7 @@ export default class DateTime { if (this.isValid) { return this.zone.offsetName(this.ts, { format: "long", - locale: this.locale + locale: this.locale, }); } else { return null; @@ -1179,7 +1225,7 @@ export default class DateTime { * @type {boolean} */ get isOffsetFixed() { - return this.isValid ? this.zone.universal : null; + return this.isValid ? this.zone.isUniversal : null; } /** @@ -1191,7 +1237,8 @@ export default class DateTime { return false; } else { return ( - this.offset > this.set({ month: 1 }).offset || this.offset > this.set({ month: 5 }).offset + this.offset > this.set({ month: 1, day: 1 }).offset || + this.offset > this.set({ month: 5 }).offset ); } } @@ -1243,7 +1290,7 @@ export default class DateTime { * @param {Object} opts - the same options as toLocaleString * @return {Object} */ - resolvedLocaleOpts(opts = {}) { + resolvedLocaleOptions(opts = {}) { const { locale, numberingSystem, calendar } = Formatter.create( this.loc.clone(opts), opts @@ -1256,7 +1303,7 @@ export default class DateTime { /** * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime. * - * Equivalent to {@link setZone}('utc') + * Equivalent to {@link DateTime#setZone}('utc') * @param {number} [offset=0] - optionally, an offset from UTC in minutes * @param {Object} [opts={}] - options to pass to `setZone()` * @return {DateTime} @@ -1278,8 +1325,8 @@ export default class DateTime { /** * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime. * - * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link plus}. You may wish to use {@link toLocal} and {@link toUTC} which provide simple convenience wrappers for commonly used zones. - * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link Zone} class. + * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC} which provide simple convenience wrappers for commonly used zones. + * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class. * @param {Object} opts - options * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this. * @return {DateTime} @@ -1324,7 +1371,7 @@ export default class DateTime { /** * "Set" the values of specified units. Returns a newly-constructed DateTime. - * You can only set units with this method; for "setting" metadata, see {@link reconfigure} and {@link setZone}. + * You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}. * @param {Object} values - a mapping of units to numbers * @example dt.set({ year: 2017 }) * @example dt.set({ hour: 8, minute: 30 }) @@ -1335,7 +1382,7 @@ export default class DateTime { set(values) { if (!this.isValid) return this; - const normalized = normalizeObject(values, normalizeUnit, []), + const normalized = normalizeObject(values, normalizeUnit), settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || @@ -1358,11 +1405,11 @@ export default class DateTime { let mixed; if (settingWeekStuff) { - mixed = weekToGregorian(Object.assign(gregorianToWeek(this.c), normalized)); + mixed = weekToGregorian({ ...gregorianToWeek(this.c), ...normalized }); } else if (!isUndefined(normalized.ordinal)) { - mixed = ordinalToGregorian(Object.assign(gregorianToOrdinal(this.c), normalized)); + mixed = ordinalToGregorian({ ...gregorianToOrdinal(this.c), ...normalized }); } else { - mixed = Object.assign(this.toObject(), normalized); + mixed = { ...this.toObject(), ...normalized }; // if we didn't set the day but we ended up on an overflow date, // use the last day of the right month @@ -1390,19 +1437,19 @@ export default class DateTime { */ plus(duration) { if (!this.isValid) return this; - const dur = friendlyDuration(duration); + const dur = Duration.fromDurationLike(duration); return clone(this, adjustTime(this, dur)); } /** * Subtract a period of time to this DateTime and return the resulting DateTime - * See {@link plus} + * See {@link DateTime#plus} * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() @return {DateTime} - */ + */ minus(duration) { if (!this.isValid) return this; - const dur = friendlyDuration(duration).negate(); + const dur = Duration.fromDurationLike(duration).negate(); return clone(this, adjustTime(this, dur)); } @@ -1480,11 +1527,10 @@ export default class DateTime { /** * Returns a string representation of this DateTime formatted according to the specified format string. - * **You may not want this.** See {@link toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens). + * **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens). * Defaults to en-US if no locale has been specified, regardless of the system's locale. - * @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 + * @param {Object} opts - opts to override the configuration options on this DateTime * @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' @@ -1503,21 +1549,22 @@ export default class DateTime { * of the DateTime in the assigned locale. * 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 + * @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options + * @param {Object} opts - opts to override the configuration options on this DateTime * @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.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022' * @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' + * @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32' * @return {string} */ - toLocaleString(opts = Formats.DATE_SHORT) { + toLocaleString(formatOpts = Formats.DATE_SHORT, opts = {}) { return this.isValid - ? Formatter.create(this.loc.clone(opts), opts).formatDateTime(this) + ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID; } @@ -1546,19 +1593,31 @@ 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.extendedZone=false] - add the time zone format extension * @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.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z' * @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 = {}) { + toISO({ + format = "extended", + suppressSeconds = false, + suppressMilliseconds = false, + includeOffset = true, + extendedZone = false, + } = {}) { if (!this.isValid) { return null; } - return `${this.toISODate(opts)}T${this.toISOTime(opts)}`; + const ext = format === "extended"; + + let c = toISODate(this, ext); + c += "T"; + c += toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone); + return c; } /** @@ -1570,12 +1629,11 @@ export default class DateTime { * @return {string} */ toISODate({ format = "extended" } = {}) { - let fmt = format === "basic" ? "yyyyMMdd" : "yyyy-MM-dd"; - if (this.year > 9999) { - fmt = "+" + fmt; + if (!this.isValid) { + return null; } - return toTechFormat(this, fmt); + return toISODate(this, format === "extended"); } /** @@ -1593,6 +1651,7 @@ 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.extendedZone=true] - add the time zone format extension * @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' @@ -1606,19 +1665,29 @@ export default class DateTime { suppressSeconds = false, includeOffset = true, includePrefix = false, - format = "extended" + extendedZone = false, + format = "extended", } = {}) { - return toTechTimeFormat(this, { - suppressSeconds, - suppressMilliseconds, - includeOffset, - includePrefix, - format - }); + if (!this.isValid) { + return null; + } + + let c = includePrefix ? "T" : ""; + return ( + c + + toISOTime( + this, + format === "extended", + suppressSeconds, + suppressMilliseconds, + includeOffset, + extendedZone + ) + ); } /** - * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC + * Returns an RFC 2822-compatible string representation of this DateTime * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000' * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400' * @return {string} @@ -1628,7 +1697,7 @@ export default class DateTime { } /** - * Returns a string representation of this DateTime appropriate for use in HTTP headers. + * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT. * Specifically, the string conforms to RFC 1123. * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT' @@ -1645,7 +1714,10 @@ export default class DateTime { * @return {string} */ toSQLDate() { - return toTechFormat(this, "yyyy-MM-dd"); + if (!this.isValid) { + return null; + } + return toISODate(this, true); } /** @@ -1653,18 +1725,28 @@ export default class DateTime { * @param {Object} opts - options * @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' + * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' * @example DateTime.utc().toSQL() //=> '05:15:16.345' * @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 } = {}) { - return toTechTimeFormat(this, { - includeOffset, - includeZone, - spaceZone: true - }); + toSQLTime({ includeOffset = true, includeZone = false, includeOffsetSpace = true } = {}) { + let fmt = "HH:mm:ss.SSS"; + + if (includeZone || includeOffset) { + if (includeOffsetSpace) { + fmt += " "; + } + if (includeZone) { + fmt += "z"; + } else if (includeOffset) { + fmt += "ZZ"; + } + } + + return toTechFormat(this, fmt, true); } /** @@ -1672,6 +1754,7 @@ export default class DateTime { * @param {Object} opts - options * @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' + * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z' * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00' * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000' @@ -1695,7 +1778,7 @@ export default class DateTime { } /** - * Returns the epoch milliseconds of this DateTime. Alias of {@link toMillis} + * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis} * @return {number} */ valueOf() { @@ -1719,6 +1802,14 @@ export default class DateTime { } /** + * Returns the epoch seconds (as a whole number) of this DateTime. + * @return {number} + */ + toUnixInteger() { + return this.isValid ? Math.floor(this.ts / 1000) : NaN; + } + + /** * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON. * @return {string} */ @@ -1744,7 +1835,7 @@ export default class DateTime { toObject(opts = {}) { if (!this.isValid) return {}; - const base = Object.assign({}, this.c); + const base = { ...this.c }; if (opts.includeConfig) { base.outputCalendar = this.outputCalendar; @@ -1781,16 +1872,10 @@ export default class DateTime { */ diff(otherDateTime, unit = "milliseconds", opts = {}) { if (!this.isValid || !otherDateTime.isValid) { - return Duration.invalid( - this.invalid || otherDateTime.invalid, - "created by diffing an invalid DateTime" - ); + return Duration.invalid("created by diffing an invalid DateTime"); } - const durOpts = Object.assign( - { locale: this.locale, numberingSystem: this.numberingSystem }, - opts - ); + const durOpts = { locale: this.locale, numberingSystem: this.numberingSystem, ...opts }; const units = maybeArray(unit).map(Duration.normalizeUnit), otherIsLater = otherDateTime.valueOf() > this.valueOf(), @@ -1803,7 +1888,7 @@ export default class DateTime { /** * Return the difference between this DateTime and right now. - * See {@link diff} + * See {@link DateTime#diff} * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration * @param {Object} opts - options that affect the creation of the Duration * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use @@ -1825,7 +1910,7 @@ export default class 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. + * 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. * @param {DateTime} otherDateTime - the other DateTime * @param {string} unit - the unit of time to check sameness on * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day @@ -1835,13 +1920,13 @@ export default class DateTime { if (!this.isValid) return false; const inputMs = otherDateTime.valueOf(); - const otherZoneDateTime = this.setZone(otherDateTime.zone, { keepLocalTime: true }); - return otherZoneDateTime.startOf(unit) <= inputMs && inputMs <= otherZoneDateTime.endOf(unit); + const adjustedToZone = this.setZone(otherDateTime.zone, { keepLocalTime: true }); + return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit); } /** * Equality check - * Two DateTimes are equal iff they represent the same millisecond, have the same zone and location, and are both valid. + * Two DateTimes are equal if and only if they represent the same millisecond, have the same zone and location, and are both valid. * To compare just the millisecond values, use `+dt1 === +dt2`. * @param {DateTime} other - the other DateTime * @return {boolean} @@ -1876,7 +1961,7 @@ export default class DateTime { */ toRelative(options = {}) { if (!this.isValid) return null; - const base = options.base || DateTime.fromObject({ zone: this.zone }), + 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; @@ -1884,15 +1969,12 @@ export default class DateTime { units = options.unit; unit = undefined; } - return diffRelative( - base, - this.plus(padding), - Object.assign(options, { - numeric: "always", - units, - unit - }) - ); + return diffRelative(base, this.plus(padding), { + ...options, + numeric: "always", + units, + unit, + }); } /** @@ -1911,15 +1993,12 @@ export default class DateTime { toRelativeCalendar(options = {}) { if (!this.isValid) return null; - return diffRelative( - options.base || DateTime.fromObject({ zone: this.zone }), - this, - Object.assign(options, { - numeric: "auto", - units: ["years", "months", "days"], - calendary: true - }) - ); + return diffRelative(options.base || DateTime.fromObject({}, { zone: this.zone }), this, { + ...options, + numeric: "auto", + units: ["years", "months", "days"], + calendary: true, + }); } /** @@ -1931,7 +2010,7 @@ export default class DateTime { if (!dateTimes.every(DateTime.isDateTime)) { throw new InvalidArgumentError("min requires all arguments be DateTimes"); } - return bestBy(dateTimes, i => i.valueOf(), Math.min); + return bestBy(dateTimes, (i) => i.valueOf(), Math.min); } /** @@ -1943,7 +2022,7 @@ export default class DateTime { if (!dateTimes.every(DateTime.isDateTime)) { throw new InvalidArgumentError("max requires all arguments be DateTimes"); } - return bestBy(dateTimes, i => i.valueOf(), Math.max); + return bestBy(dateTimes, (i) => i.valueOf(), Math.max); } // MISC @@ -1960,7 +2039,7 @@ export default class DateTime { localeToUse = Locale.fromOpts({ locale, numberingSystem, - defaultToEN: true + defaultToEN: true, }); return explainFromTokens(localeToUse, text, fmt); } @@ -1975,7 +2054,7 @@ export default class DateTime { // FORMAT PRESETS /** - * {@link toLocaleString} format like 10/14/1983 + * {@link DateTime#toLocaleString} format like 10/14/1983 * @type {Object} */ static get DATE_SHORT() { @@ -1983,7 +2062,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like 'Oct 14, 1983' + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983' * @type {Object} */ static get DATE_MED() { @@ -1991,7 +2070,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like 'Fri, Oct 14, 1983' + * {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983' * @type {Object} */ static get DATE_MED_WITH_WEEKDAY() { @@ -1999,7 +2078,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like 'October 14, 1983' + * {@link DateTime#toLocaleString} format like 'October 14, 1983' * @type {Object} */ static get DATE_FULL() { @@ -2007,7 +2086,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like 'Tuesday, October 14, 1983' + * {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983' * @type {Object} */ static get DATE_HUGE() { @@ -2015,7 +2094,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. + * {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. * @type {Object} */ static get TIME_SIMPLE() { @@ -2023,7 +2102,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. + * {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. * @type {Object} */ static get TIME_WITH_SECONDS() { @@ -2031,7 +2110,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. + * {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. * @type {Object} */ static get TIME_WITH_SHORT_OFFSET() { @@ -2039,7 +2118,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. * @type {Object} */ static get TIME_WITH_LONG_OFFSET() { @@ -2047,7 +2126,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like '09:30', always 24-hour. + * {@link DateTime#toLocaleString} format like '09:30', always 24-hour. * @type {Object} */ static get TIME_24_SIMPLE() { @@ -2055,7 +2134,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like '09:30:23', always 24-hour. + * {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour. * @type {Object} */ static get TIME_24_WITH_SECONDS() { @@ -2063,7 +2142,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like '09:30:23 EDT', always 24-hour. + * {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour. * @type {Object} */ static get TIME_24_WITH_SHORT_OFFSET() { @@ -2071,7 +2150,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. + * {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. * @type {Object} */ static get TIME_24_WITH_LONG_OFFSET() { @@ -2079,7 +2158,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. * @type {Object} */ static get DATETIME_SHORT() { @@ -2087,7 +2166,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. * @type {Object} */ static get DATETIME_SHORT_WITH_SECONDS() { @@ -2095,7 +2174,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. * @type {Object} */ static get DATETIME_MED() { @@ -2103,7 +2182,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. * @type {Object} */ static get DATETIME_MED_WITH_SECONDS() { @@ -2111,7 +2190,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. + * {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. * @type {Object} */ static get DATETIME_MED_WITH_WEEKDAY() { @@ -2119,7 +2198,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. + * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. * @type {Object} */ static get DATETIME_FULL() { @@ -2127,7 +2206,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. + * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. * @type {Object} */ static get DATETIME_FULL_WITH_SECONDS() { @@ -2135,7 +2214,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. * @type {Object} */ static get DATETIME_HUGE() { @@ -2143,7 +2222,7 @@ export default class DateTime { } /** - * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. * @type {Object} */ static get DATETIME_HUGE_WITH_SECONDS() { |
