Comparing version 3.4.0 to 3.4.1
{ | ||
"name": "luxon", | ||
"version": "3.4.0", | ||
"version": "3.4.1", | ||
"description": "Immutable date wrapper", | ||
@@ -32,3 +32,4 @@ "author": "Isaac Cambron", | ||
"prepack": "babel-node tasks/buildAll.js", | ||
"prepare": "husky install" | ||
"prepare": "husky install", | ||
"show-site": "http-server build" | ||
}, | ||
@@ -53,2 +54,3 @@ "lint-staged": { | ||
"fs-extra": "^6.0.1", | ||
"http-server": "^14.1.1", | ||
"husky": "^7.0.0", | ||
@@ -55,0 +57,0 @@ "jest": "^29.4.3", |
@@ -13,2 +13,3 @@ import { InvalidArgumentError, InvalidDurationError, InvalidUnitError } from "./errors.js"; | ||
roundTo, | ||
signedFloor, | ||
} from "./impl/util.js"; | ||
@@ -137,5 +138,5 @@ import Settings from "./settings.js"; | ||
function convert(matrix, fromMap, fromUnit, toMap, toUnit) { | ||
const conv = matrix[toUnit][fromUnit], | ||
raw = fromMap[fromUnit] / conv, | ||
added = Math.floor(raw); | ||
const conv = matrix[toUnit][fromUnit]; | ||
const raw = fromMap[fromUnit] / conv; | ||
const added = signedFloor(raw); | ||
@@ -467,2 +468,4 @@ toMap[toUnit] = removePrecisionIssue(toMap[toUnit] + added); | ||
toHuman(opts = {}) { | ||
if (!this.isValid) return INVALID; | ||
const l = orderedUnits | ||
@@ -582,5 +585,7 @@ .map((unit) => { | ||
toMillis() { | ||
if (!this.isValid) return NaN; | ||
let sum = this.values.milliseconds ?? 0; | ||
for (let unit of reverseUnits.slice(1)) { | ||
if (this.values?.[unit]) { | ||
if (this.values[unit]) { | ||
sum += this.values[unit] * this.matrix[unit]["milliseconds"]; | ||
@@ -587,0 +592,0 @@ } |
@@ -127,2 +127,6 @@ /* | ||
export function signedFloor(number) { | ||
return number > 0 ? Math.floor(number) : Math.ceil(number); | ||
} | ||
export function roundTo(number, digits, towardZero = false) { | ||
@@ -129,0 +133,0 @@ const factor = 10 ** digits, |
@@ -12,3 +12,3 @@ import DateTime from "./datetime.js"; | ||
const VERSION = "3.4.0"; | ||
const VERSION = "3.4.1"; | ||
@@ -15,0 +15,0 @@ export { |
{ | ||
"type": "module", | ||
"version": "3.4.0" | ||
"version": "3.4.1" | ||
} |
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
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
4066814
42424
20
40