Luxon: `DateTime.diff` produces different `days` value if `months` is present

Created on 1 Apr 2019  路  2Comments  路  Source: moment/luxon

Simple reproduction case. Maybe it's related to March 31st -> April 1st? Or the quarter changing?

const { DateTime } = require("luxon");

const left = DateTime.fromJSDate(new Date(1554036127038));
const right = DateTime.fromJSDate(new Date(1554122527128));

const diff1 = right.diff(left, ["months", "days", "hours"]);
const diff2 = right.diff(left, ["days", "hours"]);

console.log(diff1.days); // Prints 2
console.log(diff2.days); // Prints 1
bug

Most helpful comment

Fixed in 6a926b2, will release soon.

All 2 comments

hmm, yeah, looks like a bug

Fixed in 6a926b2, will release soon.

Was this page helpful?
0 / 5 - 0 ratings