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

Version Path
playbook_ui_docs-14.11.1.pre.alpha.PLAY1720phonenumberinputformatAsYouType5377 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.11.1.pre.alpha.PLAY1720phonenumberinputformatAsYouType5377 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.11.1.pre.alpha.play17725374 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.11.1.pre.alpha.play17725374 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.11.1.pre.alpha.play17725372 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.11.1.pre.alpha.play17725372 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.12.0.pre.rc.4 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.12.0.pre.rc.4 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.11.1.pre.alpha.hfhbrakemanplaybook5370 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.11.1.pre.alpha.hfhbrakemanplaybook5370 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.11.1.pre.alpha.responsivetablerails5364 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.11.1.pre.alpha.responsivetablerails5364 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.11.1.pre.alpha.responsivetablerails5362 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.11.1.pre.alpha.responsivetablerails5362 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.11.1.pre.alpha.PBNTR769sticky5359 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.11.1.pre.alpha.PBNTR769sticky5359 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.11.1.pre.alpha.PBNTR573datepickerinvestigation5355 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.11.1.pre.alpha.PBNTR573datepickerinvestigation5355 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5341 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5341 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx