Comparing version 2.3.2 to 2.4.0
{ | ||
"name": "luxon", | ||
"version": "2.3.2", | ||
"version": "2.4.0", | ||
"description": "Immutable date wrapper", | ||
@@ -5,0 +5,0 @@ "author": "Isaac Cambron", |
@@ -9,3 +9,2 @@ import { InvalidArgumentError, InvalidDurationError, InvalidUnitError } from "./errors.js"; | ||
hasOwnProperty, | ||
isInteger, | ||
isNumber, | ||
@@ -12,0 +11,0 @@ isUndefined, |
@@ -35,3 +35,3 @@ import { | ||
const [val, zone, next] = ex(m, cursor); | ||
return [{ ...mergedVals, ...val }, mergedZone || zone, next]; | ||
return [{ ...mergedVals, ...val }, zone || mergedZone, next]; | ||
}, | ||
@@ -70,16 +70,17 @@ [{}, null, 1] | ||
// ISO and SQL parsing | ||
const offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/, | ||
isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/, | ||
isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${offsetRegex.source}?`), | ||
isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`), | ||
isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, | ||
isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/, | ||
isoOrdinalRegex = /(\d{4})-?(\d{3})/, | ||
extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay"), | ||
extractISOOrdinalData = simpleParse("year", "ordinal"), | ||
sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/, // dumbed-down version of the ISO one | ||
sqlTimeRegex = RegExp( | ||
`${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?` | ||
), | ||
sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`); | ||
const offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/; | ||
const isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`; | ||
const isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/; | ||
const isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`); | ||
const isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`); | ||
const isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/; | ||
const isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/; | ||
const isoOrdinalRegex = /(\d{4})-?(\d{3})/; | ||
const extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay"); | ||
const extractISOOrdinalData = simpleParse("year", "ordinal"); | ||
const sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/; // dumbed-down version of the ISO one | ||
const sqlTimeRegex = RegExp( | ||
`${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?` | ||
); | ||
const sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`); | ||
@@ -262,3 +263,4 @@ function int(match, pos, fallback) { | ||
extractISOTime, | ||
extractISOOffset | ||
extractISOOffset, | ||
extractIANAZone | ||
); | ||
@@ -268,3 +270,4 @@ const extractISOWeekTimeAndOffset = combineExtractors( | ||
extractISOTime, | ||
extractISOOffset | ||
extractISOOffset, | ||
extractIANAZone | ||
); | ||
@@ -274,7 +277,12 @@ const extractISOOrdinalDateAndTime = combineExtractors( | ||
extractISOTime, | ||
extractISOOffset | ||
extractISOOffset, | ||
extractIANAZone | ||
); | ||
const extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset); | ||
const extractISOTimeAndOffset = combineExtractors( | ||
extractISOTime, | ||
extractISOOffset, | ||
extractIANAZone | ||
); | ||
/** | ||
/* | ||
* @private | ||
@@ -319,8 +327,2 @@ */ | ||
const extractISOYmdTimeOffsetAndIANAZone = combineExtractors( | ||
extractISOYmd, | ||
extractISOTime, | ||
extractISOOffset, | ||
extractIANAZone | ||
); | ||
const extractISOTimeOffsetAndIANAZone = combineExtractors( | ||
@@ -335,5 +337,5 @@ extractISOTime, | ||
s, | ||
[sqlYmdWithTimeExtensionRegex, extractISOYmdTimeOffsetAndIANAZone], | ||
[sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], | ||
[sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone] | ||
); | ||
} |
@@ -16,3 +16,3 @@ import { parseMillis, isUndefined, untruncateYear, signedOffset, hasOwnProperty } from "./util.js"; | ||
const NBSP = String.fromCharCode(160); | ||
const spaceOrNBSP = `( |${NBSP})`; | ||
const spaceOrNBSP = `[ ${NBSP}]`; | ||
const spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g"); | ||
@@ -19,0 +19,0 @@ |
@@ -272,2 +272,3 @@ /* | ||
export const ianaRegex = /[A-Za-z_+-]{1,256}(:?\/[A-Za-z0-9_+-]{1,256}(\/[A-Za-z0-9_+-]{1,256})?)?/; | ||
export const ianaRegex = | ||
/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/; |
@@ -12,3 +12,3 @@ import DateTime from "./datetime.js"; | ||
const VERSION = "2.3.2"; | ||
const VERSION = "2.4.0"; | ||
@@ -15,0 +15,0 @@ export { |
@@ -25,2 +25,6 @@ import { ZoneIsAbstractError } from "./errors.js"; | ||
get ianaName() { | ||
return this.name; | ||
} | ||
/** | ||
@@ -27,0 +31,0 @@ * Returns whether the offset is known to be fixed for the whole year. |
@@ -65,2 +65,10 @@ import { formatOffset, signedOffset } from "../impl/util.js"; | ||
get ianaName() { | ||
if (this.fixed === 0) { | ||
return "Etc/UTC"; | ||
} else { | ||
return `Etc/GMT${formatOffset(-this.fixed, "narrow")}`; | ||
} | ||
} | ||
/** @override **/ | ||
@@ -67,0 +75,0 @@ offsetName() { |
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
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
3739837
41020