On a query column, if I have
DATE_FORMAT(dt1, "%Y-%m-%d") dt
and try to
use \koolreport\dashboard\metrics\Value;
...
protected function fields()
{
return [
Date::create('dt'),
$this->sum(Number::create('qty'))
];
and select ranges as thisYear() or LastYear(), it will work, but with strange numbers that I was unable to identify from where they are coming.
As soon as I change the query to
DATE_FORMAT(dt1, "%Y-%m-01 00:00:00") dt
It will work right.
I guess it all boiles down to TimeBasedMetric.php where all function enforce 00:00:00 on returns, but I´m not sure.
I would expect Date to work with values as "Y-m-d" and DateTime for values as "Y-m-d h-m-s".
But, if I need to pass "Y-m-d h-m-s" to Date, or the Date or Time functions are bugged or, the Docs are missing something.