Closed vamsideepak closed 7 years ago
in config function:
pickerProvider.setRangeDefaultList([
{
label: 'All',
startDate: null,
endDate: null
}, {
label: 'Today',
startDate: moment().utc().startOf('day'),
endDate: moment().utc().endOf('day')
}, {
label: 'Yesterday',
startDate: moment().subtract(1, 'd').startOf('day'),
endDate: moment().subtract(1, 'd').endOf('day')
}, {
label: 'Current Week',
startDate: moment().startOf('week'),
endDate: moment().endOf('week')
}, {
label: 'Current Month',
startDate: moment().startOf('month'),
endDate: moment().endOf('month')
}, {
label: 'Current Year',
startDate: moment().startOf('year'),
endDate: moment().endOf('year')
}]);
It should be fixed now in the master branch. This functionality was broken by commit ff038cf739931bac35a2366d1a41a9a15c3e27c1
The correct way to initialize the model would be the following:
vm.employee = {};
vm.employee.default = {
startDate: moment(),
endDate: moment().add(1, 'days')
};
<sm-range-picker-input
fname="Date of Pay"
label="Date of Pay"
form="test"
ng-model="vm.employee.default"
flex="50"
format="DD-MMM-YYYY"
floating-label="true"
divider="To"
week-start-day="Monday"
custom-to-home="true"
allow-clear="true"
allow-empty="true"
on-range-select="vm.dayofPaySelected(range)">
</sm-range-picker-input>
i can't to set(bind) default range(example today date) in sm range picker. can anyone help me in this ? am using moment.js