Element: [Bug Report] Start & End Time, Steps with Datetime picker does not work

Created on 12 Oct 2017  ·  13Comments  ·  Source: ElemeFE/element

Element UI version

2.0.0-alpha.2

OS/Browsers version

Chrome 61

Vue version

2.4.4

Reproduction Link

https://jsfiddle.net/q017hro4/

Steps to reproduce

Just enter the start time, end time, and steps to the pickoptions of a datetime picker.

What is Expected?

The time should have a set start, end time and use steps.

What is actually happening?

It is not using those time options.

Most helpful comment

About date-time-picker selectableRange's not working, I find a trick way to slove the problem.
let range = [moment('2018-12-11 12:00:00','YYYY-MM-DD HH:mm:ss').toDate(), moment().toDate()];
this.$refs.dateTimePicker.picker.$refs.timepicker.$refs.spinner.selectableRange=[range];

All 13 comments

start,end, step only work for TimeSelect, use selectableRange for DateTimePicker

Thanks for the response. I guess I didn't fully understand the documentation. I assume steps are not allowed selectableRange? Any plan of implementing it? Thanks for all your work. Love this datetimepicker!

DateTimePicker basically = DatePicker + TimePicker

TimePicker = choose any time, eg: 10:00, 10:01, 10:02, ....
TimeSelect = choose from a list time points, eg: 10:00, 10:15, 10:30, ...

I think currently there is no plan to support TimeSelect in DateTimePicker

Thanks @wacky6 ! Appreciate your support.

My bad, I thought the Time Select was a part of the Time Picker, I misunderstood that part. Ok, fair enough. Would love to see it sometime though :-)

@wacky6 selectableRange 需要在 DateTimePicker 上设置 还是在它的picker-options 上设置

picker-options

@wacky6 并没有生效 可以来个demo么?

@Leopoldthecoder
date-time-picker 不能用 selectableRange 么?

@wacky6 我看你在其它issue的回答里提到了 可以用=.= 所以才问的

@Leopoldthecoder
date-time-picker 不能用 selectableRange 么?

https://jsfiddle.net/Lcqmjxb6/
date-time-picker 的picker-options selectableRange 没有效果

About date-time-picker selectableRange's not working, I find a trick way to slove the problem.
let range = [moment('2018-12-11 12:00:00','YYYY-MM-DD HH:mm:ss').toDate(), moment().toDate()];
this.$refs.dateTimePicker.picker.$refs.timepicker.$refs.spinner.selectableRange=[range];

Interesting, can you make a pr? Seems date-range.vue fails to proxy relevant props.

About date-time-picker selectableRange's not working, I find a trick way to slove the problem.
let range = [moment('2018-12-11 12:00:00','YYYY-MM-DD HH:mm:ss').toDate(), moment().toDate()];
this.$refs.dateTimePicker.picker.$refs.timepicker.$refs.spinner.selectableRange=[range];

thk to this,
I set pickerOptions.onPick around here

// import dayjs or moment
// next line added out of pickerOptions
const vm = this;


onPick({ maxDate, minDate}) {
  // same day
  if (dayjs(minDate).isSame(dayjs(), 'day')) {
    const range = [dayjs().set('hour', 0).set('minute', 0).set('second', 0).toDate(), dayjs().toDate()]
    this.$nextTick(() => {
      vm.$refs.dateTimePicker.picker.$refs.minTimePicker.$refs.spinner.selectableRange = [range];
    })
  }
  if (dayjs(maxDate).isSame(dayjs(), 'day')) {
    const range = [dayjs().set('hour', 0).set('minute', 0).set('second', 0).toDate(), dayjs().toDate()]
    this.$nextTick(() => {
      vm.$refs.dateTimePicker.picker.$refs.maxTimePicker.$refs.spinner.selectableRange = [range];
    })
  }
},
Was this page helpful?
0 / 5 - 0 ratings

Related issues

smallpath picture smallpath  ·  3Comments

yorululu picture yorululu  ·  3Comments

zhguokai picture zhguokai  ·  3Comments

chao-hua picture chao-hua  ·  3Comments

Zhao-github picture Zhao-github  ·  3Comments