Comparing version 0.2.4 to 0.2.5
# Changelog | ||
## 0.2.5 | ||
* Better shiftTo behavior for durations with floating point components | ||
## 0.2.4 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "luxon", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Immutable date wrapper", | ||
@@ -5,0 +5,0 @@ "author": "Isaac Cambron", |
@@ -478,11 +478,12 @@ import { Util } from './impl/util'; | ||
if (units.indexOf(k) >= 0) { | ||
built[k] = 0; | ||
lastUnit = k; | ||
let own = 0; | ||
// anything we haven't boiled down yet should get boiled to this unit | ||
for (const ak in accumulated) { | ||
if (accumulated.hasOwnProperty(ak)) { | ||
built[k] += this.matrix[ak][k] * accumulated[ak]; | ||
own += this.matrix[ak][k] * accumulated[ak]; | ||
accumulated[ak] = 0; | ||
} | ||
delete accumulated[ak]; | ||
} | ||
@@ -492,5 +493,9 @@ | ||
if (Util.isNumber(vals[k])) { | ||
built[k] += vals[k]; | ||
own += vals[k]; | ||
} | ||
const i = Math.trunc(own); | ||
built[k] = i; | ||
accumulated[k] = own - i; | ||
// plus anything further down the chain that should be rolled up in to this | ||
@@ -515,7 +520,9 @@ for (const down in vals) { | ||
if (accumulated.hasOwnProperty(key)) { | ||
built[lastUnit] += accumulated[key] / this.matrix[lastUnit][key]; | ||
if (accumulated[key] > 0) { | ||
built[lastUnit] += | ||
key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key]; | ||
} | ||
} | ||
} | ||
} | ||
return clone(this, { values: built }, true); | ||
@@ -522,0 +529,0 @@ } |
@@ -75,4 +75,4 @@ import { DateTime } from './datetime'; | ||
* @example Info.weekdays('short')[0] //=> 'Mon' | ||
* @example Info.weekdays('short', 'fr-CA')[0] //=> 'lun.' | ||
* @example Info.weekdays('short', 'ar')[0] //=> 'الاثنين' | ||
* @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.' | ||
* @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين' | ||
* @return {[string]} | ||
@@ -105,3 +105,3 @@ */ | ||
* @example Info.meridiems() //=> [ 'AM', 'PM' ] | ||
* @example Info.meridiems('de') //=> [ 'vorm.', 'nachm.' ] | ||
* @example Info.meridiems({ locale: 'de' }) //=> [ 'vorm.', 'nachm.' ] | ||
* @return {[string]} | ||
@@ -120,3 +120,3 @@ */ | ||
* @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ] | ||
* @example Info.eras('long', 'fr') //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] | ||
* @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] | ||
* @return {[string]} | ||
@@ -123,0 +123,0 @@ */ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
637352
17485