react-hook-formreact-datetime

Reactjs: How to create a time picker


I am using react-datetime for Datetime picker

But now i am looking only for time picker

Currently I use it as:

                  <Datetime
                    inputProps={{
                      placeholder: "HH:mm",
                      style: { height: "100%" }
                    }}
                    viewMode="time"
                    timeConstraints={{
                      hours: { min: 0, max: 6 },
                      minutes: { step: 15 }
                    }}
                  />

But how can I show only time picker

I am using the below currently

https://codesandbox.io/s/relaxed-varahamihira-mo576


Solution

  • Did you try dateFormat={false} ?

    <Datetime
    dateFormat={false}
    .
    .