[BUG] Date_range start_name value always falls back to default
See original GitHub issueI tried using the date_range
field but my start_name
field always defaulted back to the start_default
.
I went to the template and dumped out the $field['value']
as it was set to be used in the start value and I got nothing. Using the same method as the End value though, I got results, dont know if its me only, but here is what I did:
if ( isset($entry) && ($entry->{$field['start_name']} instanceof \Carbon\Carbon || $entry->{$field['start_name']} instanceof \Jenssegers\Date\Date) ) {
$start_name = $entry->{$field['start_name']}->format( 'Y-m-d H:i:s' );
} else {
$start_name = null;
}
instead of the old seting of $field[‘value’], and then
<input class="datepicker-range-start" type="hidden" name="{{ $field['start_name'] }}" value="{{ old($field['start_name']) ? old($field['start_name']) : (isset($start_name) ? $start_name : (isset($field['start_default']) ? $field['start_default'] : '' )) }}">
I can make a PR if it would help.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Setting date range picker start date to blank - Stack Overflow
I tried manipulating this.startDate but couldn't manage to set it to a blank value. using this.startdate = null made the whole date range...
Read more ><input type="date"> - HTML: HyperText Markup Language
You can set a default value for the input with a date inside the value ... where the input falls back to type...
Read more >Calendar range/multiple default values cause error #3996
Set a range/multiple type date and set array Dates as default value. What is the motivation / use case for changing the behavior?...
Read more >Set default dates in date slicer range
Hi there, I have a data set with a date range between July 2012 and ... In Power BI Service, the slicer value...
Read more >How to set a DATE SLICER to TODAY by default in Power BI
With a little workaround you can set your default date slicer to today's date. In this video I show you how to do...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@bouffekai If you add that file to
/resources/views/vendor/backpack/crud/fields/date_range.blade.php
you can overwrite.Fixed by @dobromir-hristov 's PR - https://github.com/Laravel-Backpack/CRUD/pull/720.
Cheers!