secretyouth / react-datez

An easy to use, customizable mobile-friendly datepicker.
MIT License
126 stars 24 forks source link

Date format with ReduxForm #15

Closed 10SPD closed 7 years ago

10SPD commented 7 years ago

First of all, much nicer to work with than the AirBnB project. However, I can't seem to work out how to use your Date format. I must be missing something simple.

In the README your prop-type says string, but it's expecting a function. I have tried the following but no success

    <Field
         {...input}
          component={ReduxReactDatez}

          format={'DD-MM-YYYY'}        // Returns not a function

          format={() => 'DD-MM-YYYY'}        // Returns invalid date

          format={(v) => {
               return moment(new Date(v)).format('DD/MM/YYYY');   // Returns the wrong date
         }}
      />
secretyouth commented 7 years ago

Hi @10SPD, thanks!

I was extremely frustrated with react-dates and the implementation of the date of birth (year and month toggling) - so I went ahead and made my own! Glad you enjoy it!

I double checked the formatting issue, and it was an issue with redux field prop format conflicting with my component. I have since fixed it up and deployed to a new release 1.2.5

Enjoy and let me know if there are any other issues 😄

10SPD commented 7 years ago

Awesome thanks. I actually ended up using the same wrapper I used for react-dates and just switched to your component. Worked great that way and it saved me updating all my date fields in the app anyway. Keep up the good work!