Preselected today's date in my DateRangeFilter (unwanted) #126
Psenicinii-Valerian
started this conversation in
General
Replies: 3 comments 3 replies
-
It is not preselected Its just the picker has to show a date, If you pressed cancel button the fitler will not be initilized. |
Beta Was this translation helpful? Give feedback.
3 replies
-
I'm facing the same issue. As a temporary workaround I had to manually clear the date if it is today. Great to have a permanent fix for this as my workaround is far from perfect: ->afterStateUpdated(function (?string &$state, ?string $old) use ($dateRangePicker) {
if ($old === null && $state === today()->format('m-d-Y') . ' - ' . today()->format('m-d-Y')) {
$dateRangePicker->clear();
}
}); |
Beta Was this translation helpful? Give feedback.
0 replies
-
Issue has been addressed in the beta version, please test the version 3.1.beta. Thanks for using the plugin |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I just open to check my DateRangeFilter it automatically sets me a default today's date - which is unwanted for me at this moment. The thing is that even tho I do not click on "Apply" button, if I leave the modal (where choosing a date) it sets me automatically as filter today's date. Same thing occurs with "Cancel" button. In every case it keeps me as active filter today's date. Currently the only way to avoid this unwanted "feature" is to select other date(range of dates). But what if I accidentally click on my DateRangePicker? I always have to clear the filter as it sets automatically for today's date? Maybe anyone has an idea on how to solve this? (*I do not have enabled the defaultToday() method). This is how my DateRangePicker Component looks like:
DateRangeFilter::make('date')
->label('Data')
->disableClear()
->separator(' - ')
->linkedCalendars(false)
->disableRanges()
->placeholder("Enter Data")
->showDropdowns()->minYear(2010)->maxYear(2030)
->startDate(null)
->endDate(null),
In the attachments below you can see how my DateRangePicker displays when clicking (it has preselected today's date - with blue bacground)
And I still get this filter everytime I try to press "Cancel" button or click outside the modal.
Beta Was this translation helpful? Give feedback.
All reactions