I'm using Wintercms (fork of Octobercms) to create a backend application which needs to display some data according to a date range.
I've used the list filters to be able to select custom date range: 
I haven't found any way of doing so in the documentations nor in internet examples..
CodePudding user response:
Calculate dynamic defaults by adding scope definition in ListFilterExtendScopes event: https://wintercms.com/docs/backend/lists#extend-filter-scopes
Default for daterange scope is array of :afterDate and :beforeDate values:
$filter->addScopes([
'latest' => [
'label' => 'Latest',
'type' => 'daterange',
'conditions' => 'latest >= \':afterDate\' AND latest <= \':beforeDate\'',
'yearRange' => '20',
'default' => [
0: Carbon::now()->subDays(10),
1: Carbon::now()->addDays(10),
],
],
]);
