chervand/yii-bootstrap-daterangepicker

v1.0.0 2015-03-17 15:44 UTC

This package is not auto-updated.

Last update: 2024-12-21 18:46:57 UTC


README

BootstrapDateRangePicker is a Yii PHP framework wrapper for Date Range Picker for Bootstrap.

Usage

$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);}'
]),