Comparing version 3.0.1 to 3.0.2
{ | ||
"name": "luxon", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Immutable date wrapper", | ||
@@ -5,0 +5,0 @@ "author": "Isaac Cambron", |
@@ -11,3 +11,3 @@ # Luxon | ||
## Upgrading to 2.0 | ||
## Upgrading to 3.0 | ||
@@ -53,5 +53,5 @@ [Guide](https://moment.github.io/luxon/#upgrading) | ||
[contributing-url]: https://github.com/moment/luxon/blob/master/contributing.md | ||
[contributing-url]: https://github.com/moment/luxon/blob/master/CONTRIBUTING.md | ||
[contributing-image]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg | ||
[phasers-image]: https://img.shields.io/badge/phasers-stun-brightgreen.svg |
@@ -123,2 +123,3 @@ import { InvalidArgumentError, InvalidDurationError, InvalidUnitError } from "./errors.js"; | ||
conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy, | ||
matrix: alts.matrix || dur.matrix, | ||
}; | ||
@@ -163,3 +164,3 @@ return new Duration(conf); | ||
* | ||
* * **Creation** To create a Duration, use {@link Duration#fromMillis}, {@link Duration#fromObject}, or {@link Duration#fromISO}. | ||
* * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}. | ||
* * **Unit values** See the {@link Duration#years}, {@link Duration#months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors. | ||
@@ -178,2 +179,8 @@ * * **Configuration** See {@link Duration#locale} and {@link Duration#numberingSystem} accessors. | ||
const accurate = config.conversionAccuracy === "longterm" || false; | ||
let matrix = accurate ? accurateMatrix : casualMatrix; | ||
if (config.matrix) { | ||
matrix = config.matrix; | ||
} | ||
/** | ||
@@ -198,3 +205,3 @@ * @access private | ||
*/ | ||
this.matrix = accurate ? accurateMatrix : casualMatrix; | ||
this.matrix = matrix; | ||
/** | ||
@@ -235,3 +242,4 @@ * @access private | ||
* @param {string} opts.numberingSystem - the numbering system to use | ||
* @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use | ||
* @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use | ||
* @param {string} [opts.matrix=Object] - the custom conversion system to use | ||
* @return {Duration} | ||
@@ -252,2 +260,3 @@ */ | ||
conversionAccuracy: opts.conversionAccuracy, | ||
matrix: opts.matrix, | ||
}); | ||
@@ -286,3 +295,4 @@ } | ||
* @param {string} opts.numberingSystem - the numbering system to use | ||
* @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use | ||
* @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use | ||
* @param {string} [opts.matrix=Object] - the preset conversion system to use | ||
* @see https://en.wikipedia.org/wiki/ISO_8601#Durations | ||
@@ -309,3 +319,4 @@ * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 } | ||
* @param {string} opts.numberingSystem - the numbering system to use | ||
* @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use | ||
* @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use | ||
* @param {string} [opts.matrix=Object] - the conversion system to use | ||
* @see https://en.wikipedia.org/wiki/ISO_8601#Times | ||
@@ -627,3 +638,3 @@ * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 } | ||
* @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 } | ||
* @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === "hour" ? x * 2 : x) //=> { hours: 2, minutes: 30 } | ||
* @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === "hours" ? x * 2 : x) //=> { hours: 2, minutes: 30 } | ||
* @return {Duration} | ||
@@ -671,10 +682,5 @@ */ | ||
*/ | ||
reconfigure({ locale, numberingSystem, conversionAccuracy } = {}) { | ||
const loc = this.loc.clone({ locale, numberingSystem }), | ||
opts = { loc }; | ||
if (conversionAccuracy) { | ||
opts.conversionAccuracy = conversionAccuracy; | ||
} | ||
reconfigure({ locale, numberingSystem, conversionAccuracy, matrix } = {}) { | ||
const loc = this.loc.clone({ locale, numberingSystem }); | ||
const opts = { loc, matrix, conversionAccuracy }; | ||
return clone(this, opts); | ||
@@ -681,0 +687,0 @@ } |
@@ -395,3 +395,3 @@ import { parseMillis, isUndefined, untruncateYear, signedOffset, hasOwnProperty } from "./util.js"; | ||
function expandMacroTokens(tokens, locale) { | ||
export function expandMacroTokens(tokens, locale) { | ||
return Array.prototype.concat(...tokens.map((t) => maybeExpandMacroToken(t, locale))); | ||
@@ -398,0 +398,0 @@ } |
@@ -6,2 +6,3 @@ import DateTime from "./datetime.js"; | ||
import { normalizeZone } from "./impl/zoneUtil.js"; | ||
import Formatter from "./impl/formatter"; | ||
@@ -8,0 +9,0 @@ import { hasRelative } from "./impl/util.js"; |
@@ -30,6 +30,6 @@ import DateTime, { friendlyDateTime } from "./datetime.js"; | ||
* | ||
* * **Creation** To create an Interval, use {@link Interval#fromDateTimes}, {@link Interval#after}, {@link Interval#before}, or {@link Interval#fromISO}. | ||
* * **Creation** To create an Interval, use {@link Interval.fromDateTimes}, {@link Interval.after}, {@link Interval.before}, or {@link Interval.fromISO}. | ||
* * **Accessors** Use {@link Interval#start} and {@link Interval#end} to get the start and end. | ||
* * **Interrogation** To analyze the Interval, use {@link Interval#count}, {@link Interval#length}, {@link Interval#hasSame}, {@link Interval#contains}, {@link Interval#isAfter}, or {@link Interval#isBefore}. | ||
* * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval#merge}, {@link Interval#xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}. | ||
* * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval.merge}, {@link Interval.xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}. | ||
* * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs} | ||
@@ -36,0 +36,0 @@ * * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}. |
@@ -12,3 +12,3 @@ import DateTime from "./datetime.js"; | ||
const VERSION = "3.0.1"; | ||
const VERSION = "3.0.2"; | ||
@@ -15,0 +15,0 @@ export { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3897301
41300
1