问题
i build a form that contain month range. i am using daterangepicker bootstrap to do it. For example from Jan to April, but i cannot display month view only using viewMode: 'months', or may be there is another code to display month only?
This is my js code:
$(function () {
$('#growthrange').daterangepicker({
format: 'MM/yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
locale: {
applyLabel: 'Apply Date',
fromLabel: 'First Date',
toLabel: 'Second Date',
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
firstDay: 1
}
},
function (start, end) {
$('#growthrange span').html(start.toString('MMMM, yyyy') + '-' + end.toString('MMMM, yyyy'));
});
Help please!
回答1:
How about
This code:
$("#growthrange").daterangepicker( {
format: "mm-yyyy",
viewMode: "months",
minViewMode: "months"
});
回答2:
Me too, I tried to find solution but none really work for my context, here's whay I implemented it (with more options & event listener) : Hope this can help others if its too late for the post:
See here the git repo (Don't hesitate to contribute)
来源:https://stackoverflow.com/questions/29244590/bootstrap-date-range-picker-view-month-and-year-only