Sha256: 4c9007aad02fd37f6431822fe7d61939956cfecb8d0a00f3510cd002868961cc
Contents?: true
Size: 928 Bytes
Versions: 1065
Compression:
Stored size: 928 Bytes
Contents
import React, { useState } from 'react' import { DatePicker, LabelValue } from '../..' const DatePickerOnChange = (props) => { 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" {...props} /> <LabelValue label="Date Object" marginBottom="lg" value={dateObj[0] ? dateObj[0].toString() : ''} {...props} /> <LabelValue label="Date String" value={dateString} {...props} /> </div> ) } export default DatePickerOnChange
Version data entries
1,065 entries across 1,065 versions & 2 rubygems