I am facing weird issue with Luxon when Interval.after
method is called inside library.
const interval = Interval.after(dateTime, duration);
Following log is from the application DateTime__Duration
and second line is logged result of Interval.after
:
1535806800000__PT330M
[2018-09-01T16:00:00.000+03:00 – 2018-09-01T21:30:00.000+03:00)
However if I pass these values to library method and observe log there:
1535806800000__PT330M
Invalid Interval
Where reason is invalid endpoints
. Calling isValid
for DateTime
and Duration
returns true.
If I initialize DateTime
and Duration
exact same way that the application does, then Interval.after
works inside the lib.
const interval2 = Interval.after(DateTime.fromISO('2018-09-01T16:00:00.000+03:00',
{zone: 'Europe/Helsinki'}), Duration.fromObject({ minutes: 330 }));
Both calls are using same objects but Interval.after
works only inside the application. Any idea what could cause this?
UPDATE
This seems to be related somehow to the DateTime
. Could it behave differently in the app versus library even though luxon version is same? From what I've understood is that luxon doesn't have dependencies.
UPDATE 2
I managed to get reproducing version of this setup. Both app and lib sources can be downloaded from http://www.filedropper.com/luxon
For linking the lib locally into the app I used yarn link
in the lib and yarn link "luxon-test-lib"
in the app after that.
The reason for this happening was due to locally linking the library while developing. Therefore even though both app and lib had same luxon version, they both had separate modules. That caused luxon library to break because of instanceof
checks used there.