APIv4 - Support "relative date ranges" with the "IS" operator
Created by: totten
Before
In APIv4, there's no good way to use the "relative date ranges" (e.g. previous.month
, previous.year
, this.fiscal_year
, next.week
).
After
APIv4 supports two new query operators, IS
and IS NOT
. The IS
operator is loosely similar to the SQL IS
operator in that it accepts symbolic quasi-values (eg myfield IS null
). This flavor of IS
accepts null
as well as the relative date ranges, e.g.
civicrm_api4("Activity", "get", [
"where" => [["activity_date_time", "IS", "previous.year"]],
"select" => ["id","activity_date_time"],
"limit" => 10,
]);