Sha256: bc22abcdbaed9d4822a73e140e7b11b902256ccd8bf3ee6dc812282cc1f1f276
Contents?: true
Size: 1.03 KB
Versions: 948
Compression:
Stored size: 1.03 KB
Contents
/* eslint-disable react/no-multi-comp */ import React, { useState } from 'react' import { DatePicker,LabelValue } from 'playbook-ui' const DatePickerOnClose = (props) => { const today = new Date() const [dateString, setDateString] = useState(today.toLocaleDateString()) const [dateObj, setDateObj] = useState([today]) const handleOnClose = (selectedDates, dateStr) => { setDateString(dateStr) setDateObj(selectedDates) } return ( <div> <DatePicker defaultDate={dateString} enableTime marginBottom="lg" onClose={handleOnClose} pickerId="date-picker-on-close" showTimezone {...props} /> <LabelValue label="Date Object" marginBottom="lg" value={dateObj[0] ? dateObj[0].toString() : ''} {...props} /> <LabelValue label="Date String" value={dateString} {...props} /> </div> ) } export default DatePickerOnClose
Version data entries
948 entries across 948 versions & 2 rubygems