0

Does anyone know what is the props to make a textfield in material ui to be 24 hour format? I cant seem to find anywhere? here is my current component

                    <TextField
                      type="time"
                      variant="outlined"
                      size="small"
                      name="startTime"
                      value={this.state.startTime}
                      onChange={handleChange}
                    />

1 Answers1

0

TextField meant to be used for text, use TimePicker for that purpose

import React, { Fragment, useState } from "react";
import { TimePicker } from "@material-ui/pickers";

function BasicTimePicker() {
  const [selectedDate, handleDateChange] = useState(new Date());

  return (

      <TimePicker
        clearable
        ampm={false}
        label="24 hours"
        value={selectedDate}
        onChange={handleDateChange}
      />
  );
}

export default BasicTimePicker;
karzan
  • 31
  • 4