Sha256: 96dd6d1c31f5d7614551d361e508de54afebec6ed43314528810156966eed18f

Contents?: true

Size: 1.03 KB

Versions: 768

Compression:

Stored size: 1.03 KB

Contents

/* eslint-disable react/no-multi-comp */
import React, { useState } from 'react'
import { DatePicker,LabelValue } from '../..'


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

768 entries across 768 versions & 2 rubygems

Version Path
playbook_ui_docs-13.34.1.pre.alpha.play1407statvaluekitinconsistencies3388 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-13.34.1.pre.alpha.play1407statvaluekitinconsistencies3388 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-13.34.1.pre.alpha.PLAY14703378 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-13.34.1.pre.alpha.PLAY14703378 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-13.34.1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-13.34.1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3370 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3370 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3369 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3369 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3368 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3366 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3366 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-13.34.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-13.33.1.pre.alpha.play1407statvaluekitinconsistencies3352 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-13.33.1.pre.alpha.play1407statvaluekitinconsistencies3352 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-13.33.1.pre.alpha.PLAY14063320 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-13.33.1.pre.alpha.PLAY14063320 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-13.33.1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-13.33.0.pre.alpha.PBNTR405dropdownformfixesrails3311 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx