tonyfat
tonyfat

Reputation: 331

Material UI Pickers with Formik for both Date and Time components with seconds

I am currently working on a React app together with Formik that requires the use date and time pickers. I am building the app using Material-UI and have been looking at Material-UI Pickers over at https://material-ui-pickers.dev/

Since I am new to React/Formik/Material-UI, I have the following questions:

  1. Is it possible to use Material-UI Pickers together with Formik as I need to maintain state of all dates/time provided by user?

  2. When it comes to the user input for both dates and times, I have a case when the user needs to enter both a date as well as time but in 24 hours format and also need to include seconds, i.e.

the format that I am after is: DD/MM/YYYY HH24:MI:SS

Is this possible with Material-UI Pickers as from what I could see in there demo, I didn't see the capability to add seconds?

  1. I also have another scenario where the user input will just be a time component alone, again with seconds, just like in my previous question, i.e.:

HH24:MI:SS

I guess my main concern is, how do I allow a user to also provide the seconds SS as this is required?

Upvotes: 1

Views: 3485

Answers (1)

Goutham J.M
Goutham J.M

Reputation: 2194

Best Way to do it is using DatePicker(For setting dates) and Timepicker(Provides seconds feature also along with hour and min setting) both seperately , You can use Material UI Pickers with Formik , I have put it in a sandbox , you can refer it for implementing

Edit restless-meadow-hj0em

Upvotes: 2

Related Questions