Search code examples
javascriptluxon

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?


Solution

  • To compare just the dates, use startOf

    startDate.startOf("day") <= someDate.startOf("day")