Ash Query Time Expressions
Here's how to query using time filters with Ash.Query.
As the docs indicate, you can use various datetime functions in ash queries.
Here's an example of querying for books that were last checked out less than 14 days ago:
MyLibrary.Shelves.Book
|> Ash.Query.filter(Ash.Expr.expr(last_checked_out < ago(14, :day)))
|> Ash.read!()
Here's another example of all books checked in today:
MyLibrary.Shelves.Book
|> Ash.Query.filter(Ash.Expr.expr(last_checked_in == today()))
|> Ash.read!()
Or books that are due 2 days from now:
MyLibrary.Shelves.Book
|> Ash.Query.filter(Ash.Expr.expr(next_due_date <= from_now(2, :day)))
|> Ash.read!()
There are several other date functions and time units you can use. See the docs.