Rules/Checks against today

Rules

Checks against today

A café cannot open in the past, and its lease has to run for at least a year. Both rules compare a date with today.

"today" is today's date. { fromToday: { years: 1 } } is a year from now; months and days work too.

{ key: "opening", type: "date", label: "Opening day", checks: [{ atLeast: "today" }] },
{ key: "lease_end", type: "date", label: "Lease ends", checks: [{ atLeast: { fromToday: { years: 1 } } }] },

Add both checks, then pick yesterday as the opening day and next month as the end of the lease. The messages read Must be on or after today and Must be on or after 1 year from today.

On dates the same words mean before and after: atLeast is on or after, moreThan is after.

Up nextCalculated totals