vascofg / react-admin-date-inputs

Date Inputs for react-admin
MIT License
67 stars 81 forks source link

default use of DateInput with dateFnsUtils results in this broken picker #13

Closed zifnab87 closed 5 years ago

zifnab87 commented 5 years ago
<DateInput source="startDate" options={{ format: 'DD/MM/YYYY' }} />

image

vascofg commented 5 years ago

Can you confirm your date-fns version is exactly "2.0.0-alpha.7"?

zifnab87 commented 5 years ago

I didn't have any installed - I npm installed that specific version and I still have the same results

"dependencies": {
    "date-fns": "2.0.0-alpha.7",
    "material-ui-pickers": "^1.0.0-rc.14",
    "moment": "^2.22.2",
    "prop-types": "^15.6.2",
    "ra-data-json-server": "^2.2.2",
    "react": "^16.4.2",
    "react-admin": "^2.2.2",
    "react-admin-date-inputs": "^1.0.20",
    "react-dom": "^16.4.2",
    "react-scripts": "1.1.5"
  },
ashim-kr-saha commented 5 years ago

I can solve this by adding "material-ui-pickers": "1.0.0-rc.13" in my dependencies.

"dependencies": {
    "date-fns": "2.0.0-alpha.7",
    "ra-core": "2.3.0",
    "ra-data-json-server": "2.3.0",
    "ra-language-english": "2.3.0",
    "ra-ui-materialui": "2.3.0",
    "react": "16.3.2",
    "react-admin": "2.3.0",
    "react-admin-date-inputs": "1.0.20",
    "react-dom": "16.3.2",
    "react-scripts": "1.1.4",
    "material-ui-pickers": "1.0.0-rc.13"
}
vascofg commented 5 years ago

Please try to update to react-admin-date-inputs@1.1.0. Dependencies have been updated to date-fns@2.0.0-alpha.16 and material-ui-pickers@1.0.0-rc.14

zifnab87 commented 5 years ago

@vascofg have you npm published? I see only 1.0.20 here https://www.npmjs.com/package/react-admin-date-inputs. Also I don't see those changes in your commits. Thanks

vascofg commented 5 years ago

Indeed I have, sometimes it takes a while to publish. Please check again, it's showing up for me.

On Mon, Sep 10, 2018, 9:22 PM Michail Michailidis notifications@github.com wrote:

@vascofg https://github.com/vascofg have you npm published? I see only 1.0.20 here https://www.npmjs.com/package/react-admin-date-inputs. Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vascofg/react-admin-date-inputs/issues/13#issuecomment-420047335, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmuSVMqLkoNOVEIy2Iyg4SOF0EWmRl7ks5uZsntgaJpZM4Wa3u- .

zifnab87 commented 5 years ago

@vascofg intresting! My publishes appear right away! Thanks :) will check if everything is alright and close the issue

afilp commented 5 years ago

@vascofg I updated the library and it works, except of these "initial" strange day numbers:

image

If I choose from the calendar, they remain that big, only if I write them directly in the date input as "11" (for example) then they work. The fetches work, despite this UI issue though. Not sure what causes it.

afilp commented 5 years ago

I now notice that it works OK if I change the format (which used to work) from:

options={{format: 'DD/MM/YYYY', showTodayButton: true, keyboard: true}}

TO:

options={{format: 'dd/MM/YYYY', showTodayButton: true, keyboard: true}}

Is this a changed behavior in latest date-fns? Or a bug?

I would not like to replace all format values in my project, but I will do if this is not a bug and is an intended change.

Do you have any idea?

vascofg commented 5 years ago

Yes I noticed that too, I think it's a change on date-fns part.

On Tue, 11 Sep 2018, 16:00 afilp, notifications@github.com wrote:

I now notice that it works OK if I change the format (which used to work) from:

options={{format: 'DD/MM/YYYY', showTodayButton: true, keyboard: true}}

TO:

options={{format: 'dd/MM/YYYY', showTodayButton: true, keyboard: true}}

Is this a changed behavior in latest date-fns? Or a bug?

I would not like to replace all format values in my project, but I will do if this is not a bug and is an intended change.

Do you have any idea?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vascofg/react-admin-date-inputs/issues/13#issuecomment-420305518, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmuSb0dsWTdUO4NJHUdtfCgHPuubq1uks5uZ9AmgaJpZM4Wa3u- .

afilp commented 5 years ago

There are other problems too, between typing a date and showing it in the calendar:

image

Could it be that something needs to be changed in react-admin-date-inputs?

Thanks a lot!

afilp commented 5 years ago

Now I found that if I use format: 'dd/MM/yyyy' it seems to work (did not test all cases).

Weird?

thecassion commented 5 years ago

For me , I have this error with react-admin v2.3.1 :
image

IgorForkst commented 5 years ago

screen shot 2018-09-21 at 12 04 33 same error on react admin

mcwebb commented 5 years ago

We're also experiencing the UI issue with React Admin v2.3.2.

Is there a incompatibility with MUI?

screen shot 2018-09-24 at 10 52 19 am

vascofg commented 5 years ago

You have to provide a material icons font, as explained in material-ui-pickers docs

On Mon, 24 Sep 2018, 07:49 Matthew Webb, notifications@github.com wrote:

We're also experiencing the UI issue with React Admin v2.3.2.

Is there a incompatibility with MUI?

[image: screen shot 2018-09-24 at 10 52 19 am] https://user-images.githubusercontent.com/610528/45938871-9b635c00-bfeb-11e8-8cda-d5bbd1efa4a6.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vascofg/react-admin-date-inputs/issues/13#issuecomment-423881609, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmuSWw6wMNO3QbdfjIhCFk6ca51uaUlks5ueHJQgaJpZM4Wa3u- .

mcwebb commented 5 years ago

Thank you @vascofg, that was indeed the issue, sorry :)

jheiska commented 5 years ago

@vascofg I updated the library and it works, except of these "initial" strange day numbers:

image

If I choose from the calendar, they remain that big, only if I write them directly in the date input as "11" (for example) then they work. The fetches work, despite this UI issue though. Not sure what causes it.

This same issue appears for me, using your version 1.1.2 and the version 2.7.0 of react-admin. Testing it out it seems the number it shows is what "day of the year" that day is. So, if I pick december 31, it shows 365 there. Changing between caps and low-case letters in the format dd/mm/yyyy doesn't seem to make a difference. The date is actually sent correctly, but this can be "slightly" confusing for the user.

EDIT: Weird enough, I changed all my date/datetime inputs back to the react-admin ones. After a while I decided to fool around with the components once more, and changed back to readt-admin-date-inputs. Suddenly the date appears correctly. Just for the record, the format I use is "dd/MM/yyyy, HH:mm:ss". I'm pretty sure I did try that one earlier so not 100% if that has anything to do with the actual problem causing the odd behavior.