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-8.0.3 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-8.2.0.pre.alpha2 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-8.1.1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-8.0.2 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-8.2.0.pre.alpha1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-8.1.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-8.0.1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-8.0.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-8.0.0.pre.alpha5 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-8.0.0.pre.alpha4 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-8.0.0.pre.alpha1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-7.16.0.pre.alpha5 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-7.16.0.pre.alpha4 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-7.16.0.pre.alpha3 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-7.16.0.pre.alpha2 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-7.16.0.pre.alpha1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-7.14.0.pre.alpha1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-7.16.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-7.15.1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx
playbook_ui-7.15.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx