Hi I would like to express a luxon interval in a localized human-readable manner (Eg. 9 days, 3 hours).
I have achieved this starting from present moment. With this code:
DateTime.fromISO(value).toRelative({ locale: "es" });
But I cannot achieve the same using neither the Interval o the Duration objects.
This get's the job done. But is not really localization.
const start = DateTime.fromSQL("2020-06-19 11:14:00");
const finish = DateTime.fromSQL("2020-06-21 13:11:00");
const {days, hours, minutes} = Interval
.fromDateTimes(start, finish, {locale: "es"})
.toDuration(["days", "hours", "minutes"]).values;
console.log(
`${days ? days + " días " : ""} ${hours ? hours + " horas" : ""} ${
minutes ? minutes + " minutos." : ""
}`
);