vue-rangedate-picker icon indicating copy to clipboard operation
vue-rangedate-picker copied to clipboard

Initial Select range date

Open aepsaepudin94 opened this issue 7 years ago • 9 comments

How i can initialize selected date ?

aepsaepudin94 avatar Feb 14 '18 07:02 aepsaepudin94

Initialise value to dateRange Object (rangedate-picker.js)

joethekurian avatar Mar 13 '18 09:03 joethekurian

I don't know why, but this commit https://github.com/bliblidotcom/vue-rangedate-picker/commit/77cf9836f96d389dc8ea1da41cb84fe627e0d085 remove this functionality (Set initial value)

apiep avatar Mar 18 '18 16:03 apiep

Any progress on this?

Denis4yk avatar Mar 31 '18 10:03 Denis4yk

Same, this feature is not in the code base anymore, but still in the documentation. Is there any progress on this?

MrSnoozles avatar Apr 25 '18 08:04 MrSnoozles

No progress ? this.dateRange = this.initRange,why remove it? How initialize selected date ?

wujinfeng avatar May 06 '18 07:05 wujinfeng

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'
}

AndersSchmidtHansen avatar May 14 '18 10:05 AndersSchmidtHansen

借助楼上的说法,看了一眼源码,正确的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) } 文档写的也真是太简陋了...

skillnull avatar May 17 '18 06:05 skillnull

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 } }

jinfeicheng avatar Sep 28 '18 17:09 jinfeicheng

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'
}

This feature should've been available, though thanks to @AndersSchmidtHansen's trick, it all goes well!

bagaskarawg avatar Jul 07 '19 06:07 bagaskarawg