import React, { Fragment, PureComponent } from 'react'; import { TimePicker, KeyboardDatePicker, MuiPickersUtilsProvider } from '@material-ui/pickers'; import MomentUtils from '@date-io/moment'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core/styles'; import { Typography, Grid, InputAdornment, Icon, IconButton } from '@material-ui/core'; const styles = theme => ({ demo: { height: 'auto', }, divider: { display: 'block', margin: `${theme.spacing(3)}px 0`, }, picker: { margin: `${theme.spacing(3)}px 5px`, } }); class TimeInput extends PureComponent { state = { selectedDate: new Date(), } handleDateChange = (date) => { this.setState({ selectedDate: date }); } render() { const { selectedDate } = this.state; const { classes } = this.props; return ( Basic usage A time picker should adjusts to a user’s preferred time setting, i.e. the 12-hour or 24-hour format.
Keyboard Input
Custom Icon
access_time ), }} />
); } } TimeInput.propTypes = { classes: PropTypes.object.isRequired, }; export default withStyles(styles)(TimeInput);