You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

68 lines
2.0 KiB

<?PHP
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use blobt\web\DaterangeBootstrap;
$this->title = '测试';
$this->params['subtitle'] = '这是一个小小的测试';
$this->params['breadcrumbs'][] = $this->title;
$js = <<<EOT
$('#daterange-btn').daterangepicker(
{
locale: {
'cancelLabel': '清除',
'applyLabel': "确定",
"customRangeLabel": "自定义",
"daysOfWeek": [
"日",
"一",
"二",
"三",
"四",
"五",
"六"
],
"monthNames": [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月"
],
},
ranges : {
'今天' : [moment(), moment()],
'昨天' : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'最近7天' : [moment().subtract(6, 'days'), moment()],
'最近30天': [moment().subtract(29, 'days'), moment()],
'本月' : [moment().startOf('month'), moment().endOf('month')],
'上月' : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
},
startDate: moment().subtract(29, 'days'),
endDate : moment()
},
function (start, end) {
$('#daterange-btn span').html(start.format('YYYY-M-D') + ' - ' + end.format('YYYY-M-D'))
}
)
EOT;
DaterangeBootstrap::register($this);
$this->registerJs($js);
?>
<button type="button" class="btn btn-default pull-right" id="daterange-btn">
<span>
<i class="fa fa-calendar"></i>日期范围
</span>
<i class="fa fa-caret-down"></i>
</button>