SHARE
TWEET

Untitled

a guest Feb 14th, 2020 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import "date-fns";
  2. import React from "react";
  3. import Grid from "@material-ui/core/Grid";
  4. import DateFnsUtils from "@date-io/date-fns";
  5. import {
  6.   MuiPickersUtilsProvider,
  7.   KeyboardDatePicker
  8. } from "@material-ui/pickers";
  9.  
  10. export default function MaterialUIPickers() {
  11.   // The first commit of Material-UI
  12.   const [selectedDate, setSelectedDate] = React.useState(
  13.     new Date("2014-08-18T21:11:54")
  14.   );
  15.  
  16.   const handleDateChange = date => {
  17.     setSelectedDate(date);
  18.   };
  19.  
  20.   return (
  21.     <MuiPickersUtilsProvider utils={DateFnsUtils}>
  22.       <Grid container justify="space-around">
  23.         <KeyboardDatePicker
  24.           disableToolbar
  25.           variant="inline"
  26.           format="MM/dd/yyyy"
  27.           margin="normal"
  28.           id="date-picker-inline"
  29.           label="Date picker inline"
  30.           value={selectedDate}
  31.           onChange={handleDateChange}
  32.           KeyboardButtonProps={{
  33.             "aria-label": "change date"
  34.           }}
  35.         />
  36.       </Grid>
  37.     </MuiPickersUtilsProvider>
  38.   );
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top