Ash FrameworkAF
Ash Framework3y ago
11 replies
gordoneliel

How to: DateTime validation with compare/2

Im trying to compare datetime in an action with compare/2. Code looks like this:
      validate compare(:resumes_at, greater_than: DateTime.utc_now(:microsecond)),
        message: "resumes_at must be in the future",
        where: [present(:resumes_at)]


Weird thing is this validation fails even when resumes_at is in the future. Does this work or are there other ways of easily comparing datetimes in inline changes?
Was this page helpful?