Closed OwenMelbz closed 7 years ago
For anybody else interested - this is my current solution
import DatePicker from 'vue2-datepicker';
import moment from 'moment';
DatePicker.methods.initRanges = function () {
const today = moment.now();
this.ranges = [
{
text: 'Today',
start: today,
end: today,
},
{
text: 'Last 30 Days',
start: moment().day(-30),
end: today,
},
{
text: 'Last 90 Days',
start: moment().day(-90),
end: today,
},
{
text: 'Last Year',
start: moment().day(-365),
end: today,
},
{
text: 'All Time',
start: moment().day(-365 * 50),
end: today,
},
];
};
Added a prop 'shortcuts'
<date-picker v-model="time2" range :shortcuts="shortcuts"></date-picker>
shortcuts: [
{
text: 'Today',
start: new Date(),
end: new Date()
}
]
Ah @mengxiong10 this works perfectly :)
Many thanks, we have updated our project!
Hi Guys :)
Love the plugin so far - however our clients asked for different date ranges.
Is there a way to use a custom array of date ranges?
e.g.
1 Day, 1 Month, 1 Year ? I can see
How can we overwrite these?
Thanks :)