Sha256: 4c9007aad02fd37f6431822fe7d61939956cfecb8d0a00f3510cd002868961cc

Contents?: true

Size: 928 Bytes

Versions: 1065

Compression:

Stored size: 928 Bytes

Contents

import React, { useState } from 'react'
import { DatePicker, LabelValue } from '../..'

const DatePickerOnChange = (props) => {
  const today = new Date()
  const [dateString, setDateString] = useState(today.toLocaleDateString())
  const [dateObj, setDateObj] = useState([today])

  const changeHandler = (dateStr, selectedDates) => {
    setDateString(dateStr)
    setDateObj(selectedDates)
  }

  return (
    <div>
      <DatePicker
          defaultDate={dateString}
          marginBottom="lg"
          onChange={changeHandler}
          pickerId="date-picker-onchange"
          {...props}
      />
      <LabelValue
          label="Date Object"
          marginBottom="lg"
          value={dateObj[0] ? dateObj[0].toString() : ''}
          {...props}
      />
      <LabelValue
          label="Date String"
          value={dateString}
          {...props}
      />
    </div>
  )
}
export default DatePickerOnChange

Version data entries

1,065 entries across 1,065 versions & 2 rubygems

Version Path
playbook_ui-10.13.1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.13.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.13.0.pre.node.update app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.12.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.11.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.10.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.9.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.8.1.pre.alpha.flexdeps app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.9.0.pre.alpha1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.8.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.7.1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.7.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.6.2.pre.alpha.dep app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.6.1.pre.alpha1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.6.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.5.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.4.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.3.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.2.1.alpha.sisensefix app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-10.2.1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx