KoolReport's Forum

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

A bug in DateRangePicker? #2776

Closed Eugene opened this topic on on Aug 1, 2022 - 5 comments

Eugene commented on Aug 1, 2022

It worked nice but today the 1st of August the Option "This month" looks like this:

The code:

<?php DateRangePicker::create(array(
                    "name" => "dateRangeInput",
                    "format" => "Do MMM, YYYY",
                    "ranges" => array(
                        "Today" => DateRangePicker::today(),
                        "Yesterday" => DateRangePicker::yesterday(),
                        "Last 7 days" => DateRangePicker::last7days(),
                        "Last 30 days" => DateRangePicker::last30days(),
                        "This month" => DateRangePicker::thisMonth(),
                        "Last month" => DateRangePicker::lastMonth()
                    )
                )); ?>

PS Bdw in your examples "This Month" is also wrong

There are 31 days in August

KoolReport commented on Aug 1, 2022

Could you please check if the KoolReport Pro is in the latest version, we have fixed this issue before. Do you see the same issue with our example?

Eugene commented on Aug 1, 2022

In your examples the issue is different

Have a look the bottom part of my post

KoolReport commented on Aug 1, 2022

You are right. We confirm it is a bug. I will tell dev.team to fix ASAP.

KoolReport commented on Aug 2, 2022

Could you please help to open the vendor/koolreport/inputs/DateRangePicker and replace the function thisMonth with following:

    static function thisMonth()
    {
        $start = new \DateTime('now');
        $end = new \DateTime($start->format("Y-m-01 23:59:59"));
        $end->add(new \DateInterval('P1M'));
        $end->sub(new \DateInterval('P1D'));
        return array($start->format('Y-m-01 00:00:00'),$end->format('Y-m-d 23:59:59'));
    }

Let me know if it works.

Eugene commented on Aug 2, 2022

Yes, it works, Thank you

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
bug
solved

Inputs