vue-rangedate-picker
vue-rangedate-picker copied to clipboard
Initial Select range date
How i can initialize selected date ?
Initialise value to dateRange Object (rangedate-picker.js)
I don't know why, but this commit https://github.com/bliblidotcom/vue-rangedate-picker/commit/77cf9836f96d389dc8ea1da41cb84fe627e0d085 remove this functionality (Set initial value)
Any progress on this?
Same, this feature is not in the code base anymore, but still in the documentation. Is there any progress on this?
No progress ? this.dateRange = this.initRange,why remove it? How initialize selected date ?
Had a similar issue. A temporary fix that worked for me was to add a "ref" to the rangedate-picker
element and then adding the following in a mounted()
hook:
mounted () {
this.$refs.rangeDatePicker.dateRange = {
start: new Date(this.initRange.start),
end: new Date(this.initRange.end)
}
}
In my case, the initial initRange
object was like this:
{
'start': '2018-05-14T22:00:00.000Z',
'end': '2018-05-15T21:59:00.000Z'
}
借助楼上的说法,看了一眼源码,正确的initRange应该是这样的(这里用的是近7天): initRange: { 'start': new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() - 5, 0, 0), 'end': new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() + 1, 0, 0) } 文档写的也真是太简陋了...
It's worked for me. Try like this: Use this forked version instead of the origin version. https://github.com/gwindes/vue-rangedate-picker-winslow (this week as default ) <vue-rangedate-picker :initRange="datePickerConfig.initRange" const datePickerConfig = { initRange: { start: moment().startOf('week').add(2,'days')._d, end: moment().startOf('week').add(8,'days')._d } }
Had a similar issue. A temporary fix that worked for me was to add a "ref" to the
rangedate-picker
element and then adding the following in amounted()
hook:mounted () { this.$refs.rangeDatePicker.dateRange = { start: new Date(this.initRange.start), end: new Date(this.initRange.end) } }
In my case, the initial
initRange
object was like this:{ 'start': '2018-05-14T22:00:00.000Z', 'end': '2018-05-15T21:59:00.000Z' }
This feature should've been available, though thanks to @AndersSchmidtHansen's trick, it all goes well!