Question

compare only dates with luxon Datetime

I have two luxon objects,

let startDate = DateTime.fromISO(startDate)
let someDate = DateTime.fromISO(someDate)

How can I compare if someDate is <= startDate, only the dates, without the time?

 46  90921  46
1 Jan 1970

Solution

 80

To compare just the dates, use startOf

startDate.startOf("day") <= someDate.startOf("day")
2020-02-10

Solution

 23

Documentation: https://moment.github.io/luxon/#/math?id=comparing-datetimes

var DateTime = luxon.DateTime;

var d1 = DateTime.fromISO('2017-04-30');
var d2 = DateTime.fromISO('2017-04-01');

console.log(d2 < d1); //=> true
console.log(d2 > d1); //=> false
<script src="https://moment.github.io/luxon/global/luxon.min.js"></script>

2021-07-09