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

Today's date button does not work with utcOffset

Open marekadamek opened this issue 9 years ago • 1 comments

Steps to reproduce:

  1. Go to examples page: https://hacker0x01.github.io/react-datepicker/
  2. Make sure today button is working in example "Today button"
  3. Open date picker in example "TimeZone date"
  4. Click today button

Result: nothing is set in the input Expected result: today's date is set in the input (with respect to chosen utcOffset)

marekadamek avatar Oct 03 '17 16:10 marekadamek

Thanks for reporting, apparently there were two issues with the example:

  1. Set minDate and maxDate, but were not shown in code snippet. Depending on the date, "today" might have been an invalid date.
  2. Moment.js apparently removed ambiguity when setting UTC offset. Previously every number <= 12 was counted as offset in hours, now you have to set it in minutes all the time: https://momentjs.com/docs/#/manipulating/utc-offset/

I'll open a PR to fix this in the next minutes.

prayerslayer avatar Oct 30 '17 18:10 prayerslayer