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.24.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown752 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-12.24.0.pre.alpha.play824751 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.24.0.pre.alpha.play824751 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-12.24.0.pre.alpha.railsmultilevelimprovements749 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.24.0.pre.alpha.railsmultilevelimprovements749 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-12.24.0.pre.alpha.play824745 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.24.0.pre.alpha.play824745 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-12.24.0.pre.alpha.railsmultilevelimprovements742 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.24.0.pre.alpha.railsmultilevelimprovements742 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-12.24.0.pre.alpha.railsmultilevelimprovements741 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.24.0.pre.alpha.railsmultilevelimprovements741 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-12.24.0.pre.alpha.railsmultilevelimprovements739 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.24.0.pre.alpha.railsmultilevelimprovements739 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.24.0.pre.alpha.play824733 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.24.0.pre.alpha.play833boldoptionfortitle2and3721 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.24.0.pre.alpha.alphatestforselfhostfak720 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.24.0.pre.alpha.play833boldoptionfortitle2and3719 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.24.0.pre.alpha.play833boldoptionfortitle2and3717 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-12.24.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-12.23.0.pre.alpha.movemarkdown712 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx