<div class="form-group">
<div class="input-group input-group-sm" id="default-daterange">
<input type="text" name="default-daterange" class="form-control" value="<?php echo date("Y-m-d", strtotime("-7 day")) ?> ~ <?php echo date("Y-m-d") ?>" placeholder="기간선택" style="width:200px">
<span class="input-group-append">
<span class="input-group-text"><i class="fa fa-calendar"></i></span>
</span>
</div>
</div>
<link href="/assets/plugins/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet" />
<script src="/assets/plugins/bootstrap-daterangepicker/moment.js"></script>
<script src="/assets/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
<script>
$('#default-daterange').daterangepicker({
opens: 'right',
format: 'YYYY-MM-DD',
separator: ' ~ ',
startDate: moment().subtract('days', 7),
endDate: moment(),
minDate: '<?php echo date("Y-m-d", strtotime("-3 year")) ?>',
maxDate: '<?php echo date("Y-m-d") ?>',
locale: {
"format": "YYYY-MM-DD",
"separator": " ~ ",
"applyLabel": "적용",
"cancelLabel": "취소",
"fromLabel": "부터",
"toLabel": "까지",
"customRangeLabel": "사용자",
"daysOfWeek": [
"일",
"월",
"화",
"수",
"목",
"금",
"토"
],
"monthNames": [
"1월",
"2월",
"3월",
"4월",
"5월",
"6월",
"7월",
"8월",
"9월",
"10월",
"11월",
"12월"
],
"firstDay": 1
}
}, function (start, end) {
$('#default-daterange input').val(start.format('YYYY-MM-DD') + ' ~ ' + end.format('YYYY-MM-DD'));
});
</script>