question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Date_range start_name value always falls back to default

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dobromir-hristovcommented, Jun 28, 2017

@bouffekai If you add that file to /resources/views/vendor/backpack/crud/fields/date_range.blade.php you can overwrite.

0reactions
tabacitucommented, Sep 4, 2017
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found