Closed himanshugoyal5734 closed 5 years ago
@himanshugoyal5734 apply.daterangepicker: Triggered when the apply button is clicked
it is not working it tried it.
Check document, following information copied from document
Optionally, event handlers can be passed in through the eventHandlers attribute of options.
<input date-range-picker class="form-control date-picker" type="text" ng-model="date"
options="{eventHandlers: {'apply.daterangepicker': function(ev, picker) { ... }}}"/>
All event handlers from the Bootstrap daterangepicker are supported. For reference, the complete list is below:
apply.daterangepicker
: Triggered when the apply button is clicked
cancel.daterangepicker
: Triggered when the cancel button is clicked
hey @nirmalgoswami thanks for that now that it is working I need to create my own locale calendar in the ranges where a user is allowed to select only 7 days from whichever date they select but dont know how to do that
$scope.options = {
applyClass: 'btn-green',
locale: {
applyLabel: "Apply",
fromLabel: "From",
format: "YYYY-MM-DD", //will give you 2017-01-06
//format: "D-MMM-YY", //will give you 6-Jan-17
//format: "D-MMMM-YY", //will give you 6-January-17
toLabel: "To",
cancelLabel: 'Cancel',
customRangeLabel: 'Custom range'
},
ranges: {
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
}
}
Just keep 7 days in ranges object if you want to show only 7 days range
and if you want to restrict user to select only 7 days based on start date then use following code
<input date-range-picker type="text" ng-model="date" max="addDays(date, 7)" />
@nirmalgoswami can you plz explain me the second approach
i am not able to fire the function on apply function from two days ...can anybody help me to resolve this issue???