PHP code example of chervand / yii-bootstrap-daterangepicker
1. Go to this page and download the library: Download chervand/yii-bootstrap-daterangepicker library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
chervand / yii-bootstrap-daterangepicker example snippets
$this->widget('vendor.chervand.yii-bootstrap-daterangepicker.BootstrapDateRangePicker', [
'model' => $model,
'attribute' => 'date_range',
'options' => [...],
]);
$this->widget('vendor.chervand.yii-bootstrap-daterangepicker.BootstrapDateRangePicker', [
'name' => 'daterangepicker',
'options' => [...],
]);
$this->widget('vendor.chervand.yii-bootstrap-daterangepicker.BootstrapDateRangePicker', [
'selector' => '#daterangepicker',
'theme' => 'bs2',
'options' => [...],
]);
$this->widget('vendor.chervand.yii-bootstrap-daterangepicker.BootstrapDateRangePicker', [
'name' => 'daterangepicker',
'htmlOptions' => ['class' => 'form-control'],
'value'=> date('d.m.Y') . ' - ' . date('d.m.Y'),
'options' => [
'format' => 'DD.MM.YYYY',
'startDate' => 'js:moment()',
'endDate' => 'js:moment()',
'dateLimit' => ['days' => 31],
'opens' => 'left',
'applyClass' => 'btn-primary',
'cancelClass' => 'btn-default',
'ranges' => [
'Today' => ['js:moment()', 'js:moment()'],
'Yesterday' => ['js:moment().subtract(1, "days")', 'js:moment() . subtract(1, "days")'],
'Last 7 Days' => ['js:moment() . subtract(6, "days")', 'js:moment()'],
'Last 30 Days' => ['js:moment() . subtract(29, "days")', 'js:moment()'],
'This Month' => ['js:moment().startOf("month")', 'js:moment().endOf("month")'],
'Last Month' => ['js:moment().subtract(1, "month").startOf("month")', 'js:moment().subtract(1, "month").endOf("month")']
]
],
'callback' => 'js:function(start,end,label){console.log(start.toISOString(),end.toISOString(),label);}'
]),