Sha256: 0ec734cb3fa1f723a26e573ab435989e2d9f38722d3cefe20b19153a634113ab
Contents?: true
Size: 860 Bytes
Versions: 61
Compression:
Stored size: 860 Bytes
Contents
import React, { useState } from 'react' import { DatePicker, LabelValue } from '../..' const DatePickerOnChange = () => { const today = new Date() const [dateString, setDateString] = useState(today.toLocaleDateString()) const [dateObj, setDateObj] = useState([today]) const changeHandler = (dateStr, selectedDates) => { setDateString(dateStr) setDateObj(selectedDates) } return ( <div> <DatePicker defaultDate={dateString} marginBottom="lg" onChange={changeHandler} pickerId="date-picker-onchange" /> <LabelValue label="Date Object" marginBottom="lg" value={dateObj[0] ? dateObj[0].toString() : ''} /> <LabelValue label="Date String" value={dateString} /> </div> ) } export default DatePickerOnChange
Version data entries
61 entries across 61 versions & 1 rubygems