KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

\koolreport\dashboard\inputs\DateRangePicker #2941

Open Katherine Wong opened this topic on on Jan 12, 2023 - 2 comments

Katherine Wong commented on Jan 12, 2023

Can I add "Quarter" & "Year" in the selection? May I know how to do it?

KoolReport commented on Jan 12, 2023

It seems that quarter and year preset is missing from Date time picker, you can borrow the preset of Value metric instead:

<?php
use \koolreport\dashboard\inputs\DateRangePicker;
use \koolreport\dashboard\metrics\Value;

class MyRangePicker extends DateRangePicker
{
    protected function onInit()
    {
        $this
            ->ranges([
                "Today"=>DateRangePicker::today(),
                "Yesterday"=>DateRangePicker::yesterday(),
                "Last 7 days"=>DateRangePicker::last7days(),
                "Last 30 days"=>DateRangePicker::last30days(),
                "This month"=>DateRangePicker::thisMonth(),
                "Last month"=>DateRangePicker::lastMonth(),
                "This Quarter"=>Value::thisQuarter(), //This Quarter
                "Last Quarter"=>Value::lastQuarter(), //Last Quarter
                "This Year"=>Value::thisYear(), //This year
                "Last Year"=>Value::lastYear(), //Last year
            ]);
    }
}

Katherine Wong commented on Jan 16, 2023

Hi, that's great.

How about if financial period was cross the year (e.g: June 2021 - May 2022), can we specify the "yearly" option based on individual financial period?

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Inputs