KoolReport's Forum

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

Cant set startDate or endDate in DateRangePicker in Laravel view #3012

Open Brahim Stewart opened this topic on on Mar 14, 2023 - 2 comments

Brahim Stewart commented on Mar 14, 2023

Hi Im trying to set the start and end date when a page loads to specific dates in Laravel 8 view.

When I load the page it just shows todays date.

\koolreport\inputs\DateRangePicker::create(array(
	"name"=>"dateRange2",
	"startDate"=>Carbon\Carbon::create(Carbon\Carbon::now('Australia/Melbourne')->subYear()->year, 1, 1, 0, 0, 0, 'Australia/Melbourne'),
	"endDate"=>Carbon\Carbon::createMidnightDate(Carbon\Carbon::now('Australia/Melbourne')->subYear()->year, 12, 31, 'Australia/Melbourne'),
));
Sebastian Morales commented on Mar 16, 2023

Pls use "value" property as an array [ $startDate, $endDate ] instead and let us know the result:

\koolreport\inputs\DateRangePicker::create(array(
	"name"=>"dateRange2",
	"value"=>[$startDate, $endDate], //$startDate and $endDate are date strings
        ...
));
Brahim Stewart commented on Mar 16, 2023

Thank you this worked

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
solved

Inputs