Skip to content

Commit 409cff1

Browse files
authored
fix: rounding behavior in Luxon localizer (jquense#2362)
Round down the date difference returned in the diff function of the luxon localizer to the nearest whole number, aligning the behavior with other localizers. jquense#2361
1 parent 52a6d1f commit 409cff1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/localizers/luxon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ export default function (DateTime, { firstDayOfWeek = 7 } = {}) {
239239
// don't use 'defineComparators' here, as we don't want to mutate the values
240240
const dtA = DateTime.fromJSDate(a)
241241
const dtB = DateTime.fromJSDate(b)
242-
return Math.round(
242+
return Math.floor(
243243
dtB.diff(dtA, datePart, { conversionAccuracy: 'longterm' }).toObject()[
244244
datePart
245245
]

0 commit comments

Comments
 (0)