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-14.11.0.pre.rc.17 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.11.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.11.0.pre.rc.16 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.11.0.pre.rc.16 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.10.0.pre.alpha.play16825301 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.10.0.pre.alpha.play16825301 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.11.0.pre.rc.15 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.11.0.pre.rc.15 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.11.0.pre.rc.14 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.11.0.pre.rc.14 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.11.0.pre.rc.13 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.11.0.pre.rc.13 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.11.0.pre.rc.12 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.11.0.pre.rc.12 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.10.0.pre.alpha.PLAY1774timelinelabelstepspacing5274 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.10.0.pre.alpha.PLAY1774timelinelabelstepspacing5274 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.10.0.pre.alpha.play1465attempt25272 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.10.0.pre.alpha.play1465attempt25272 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui_docs-14.10.0.pre.alpha.play16825244 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx
playbook_ui-14.10.0.pre.alpha.play16825244 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.jsx