Sha256: fa9f980b744844fe1c5f40ddb90c85b04ce1c50931a463c76c0b9e6b9004a40a
Contents?: true
Size: 934 Bytes
Versions: 948
Compression:
Stored size: 934 Bytes
Contents
import React, { useState } from 'react' import { DatePicker, LabelValue } from 'playbook-ui' 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
948 entries across 948 versions & 2 rubygems