I have a time, as string "13:00:00". I need to convert it so that my date picker component gets the value in proper format because it accepts only a Date object like below:
<DatePicker
mode="time"
locale="en_GB" // Use "en_GB" here
date={new Date()}
/>
How to format the time string "13:00:00" or any other in the format HH:mm:ss, so that i can directly supply it to the date picker component.
CodePudding user response:
I was able to solve the problem by using @YevgenGorbunkov 's solution
date = {new Date().setHours(...'13:00:00'.split(':'))}