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-12.23.0.pre.alpha.movemarkdown712 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-12.23.0.pre.alpha.movemarkdown708 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.23.0.pre.alpha.movemarkdown708 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.23.0.pre.alpha.play698responsivespacingglobalprop703 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.23.0.pre.alpha.play698responsivespacingglobalprop701 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.23.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.22.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown696 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.22.0.pre.alpha.play698responsivespacingglobalprop690 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.22.0.pre.alpha.PBNTR12checkingemptyfilters686 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.22.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.21.0.pre.alpha.PLAY807RTEcustomtoolbar680 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.21.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-12.20.0.pre.alpha.movemarkdown668 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.20.0.pre.alpha.title2667 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.20.0.pre.alpha.title2665 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.20.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.19.0.pre.alpha.PLAY699zindexresponsive650 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-12.19.0.pre.alpha.movemarkdown639 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.19.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown638 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.18.0.pre.alpha.PLAY785typeaheadts632 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx