DateRangePickerHelper

DateRangePicker (current version: 3.1.0) is a great Javascript library to build a calendar and select a date or date range. Package DateRangePickerHelper (current version: 2.1.9) provides helpers to facilitate calendar settings and date retrieval. Project on GitHub. Project on Packagist. This demosite sources available here.

In your controller create an instance of DateRangePickerHelper and pass the variable to the view.


$start = new Carbon('6 days ago');
$end = new Carbon;
$cal2 = DateRangePickerHelper::init(
  'numCal2', //object id
  $start, // init date start
  $end, // init date end
  null, // inferior date limit (min. date)
  null, // superior date limit (max. date)
  [
    'formlabel' => 'Dates:', // calendar label in form
    'timePicker' => true, // hour + minutes
    "timePickerSeconds" => true, // add secondds
    'drops' => 'down', // calendat opens below
    'usehiddeninputs' => true, // hidden fiels are created automatically to return
            // values automatically to form
    'apply.daterangepicker' => // callback after "apply" button is clicked.
      "displayhiddeninputs()"; // displays data in alert
]);
  

Then print your paginator by inserting {!! cal !!} in your template.

Demo

 8/04/2022 10:05:02 PM - 10/04/2022 10:05:02 PM

Here dates are copied into hidden inputs that are automatically inserted after DateRangePicker widget.