react-datetime icon indicating copy to clipboard operation
react-datetime copied to clipboard

The default date was first day of the month when skipping selecting date

Open knilink opened this issue 9 years ago • 8 comments

This happened when:

  • User switch to time view without picking a date
  • viewMode was "time" and user selected time without picking a date.

I'm not sure whether this is a bug or not but it makes more sense if the default date is today.

My scenario is most of the time users just need to select a time but they are allow to change the date when they need. And also, default value is not allowed for preventing user from skipping the input.

Now I'm using onFocus to set default date as a workaround.

knilink avatar Feb 08 '17 23:02 knilink

Hm, not sure if I understand what actually happens. If you could either provide a step-by-step guide or create a demo, that would be very helpful! For demo you can fork this codepen: http://codepen.io/simeg/pen/mEmQmP

simeg avatar Feb 09 '17 18:02 simeg

Hi @knilink ,

What are you using for the value prop?

layneanderson avatar Feb 10 '17 21:02 layneanderson

Hi @simeg thanks for replying Step to reproduce:

  1. Assuming today is 02/23/2017.
  2. Click on react-datetime the date pike shows up and a little blue triangle highlight today's date which is 23rd.
  3. Click on "12:00 AM" without touching anything else, time picker shows up.
  4. Selet a time, then the selected datetime will be "02/01/2017 12:00 AM" which is the first day of the month.

In my case, some of the users were confused and though the blue triangle meat selected date or it's today's date by default.

knilink avatar Feb 23 '17 05:02 knilink

I can verify, this is indeed a bug.

simeg avatar Apr 21 '17 19:04 simeg

Hello everyone, one other case related to this bug:

  1. disable some dates for selecting by isValidDate property(for example any date in April disabled)
  2. change month to some disabled(if you will select April in calendar view - every date is disabled)
  3. change view to time view
  4. change time

after time changing we automatically have April 1st selected, but it is disabled date

+1

amjad-r-a avatar Oct 22 '19 18:10 amjad-r-a

+1

oddie13 avatar Nov 27 '19 08:11 oddie13

Did anyone resolve this issue?

KsuGav avatar Feb 22 '23 12:02 KsuGav