0.1.29 • Published 7 months ago

date-picker-nextjs v0.1.29

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
7 months ago

Simple Date Picker component created for Next.js projects

A datepicker component built with Next.js using FontAwesome

Installation

npm i date-picker-nextjs

Or :

yarn add date-picker-nextjs

Or :

pnpm add date-picker-nextjs

Example of use

import { DatePicker } from 'date-picker-nextjs'
import { useState } from 'react'

const Example = () => {
  const [modalDateIsOpen, setModalDateIsOpen] = useState(false)
  const [clickedInput, setClickedInput] = useState(null)

  const handleDatePicker = (e) => {
    setClickedInput(e.target.id)
    setModalDateIsOpen(true)
  }

  const submit = (e) => {
    e.preventDefault()
    // your logic
  }

  return (
    <>
      <form className="test" onSubmit={submit}>
        <label htmlFor="birthdate">Birthdate</label>
        <input
          className="input-field outline-none"
          type="text"
          id="dateOfBirth"
          placeholder="Date of birth"
          onClick={handleDatePicker}
        />

        <input type="submit" value="Submit" />
      </form>
      {modalDateIsOpen && (
        <DatePicker
          setModalDateIsOpen={setModalDateIsOpen}
          clickedInput={clickedInput}
        />
      )}
    </>
  )
}

export default Example

props:

setModalDateIsOpen : This state function is mandatory and will allow the date picker modal to close itself | Required

clickedInput : The id of the input filed to attach the date picker modal to | Required

endYear : The last year to display. Default : current year | Optional

yearCount : The nomber of years to display. Default : 100 | Optional

Additional informations:

Developper documentation

Author : Pierre-Yves Léglise

0.1.29

7 months ago

0.1.28

7 months ago

0.1.27

7 months ago

0.1.26

7 months ago

0.1.25

7 months ago

0.1.25-4

7 months ago

0.1.25-3

7 months ago

0.1.25-1

7 months ago

0.1.24

7 months ago

0.1.23

7 months ago

0.1.22

7 months ago

0.1.21

7 months ago

0.1.20

7 months ago

0.1.19

7 months ago

0.1.18

7 months ago

0.1.17

7 months ago

0.1.16-b

7 months ago

0.1.15-b

7 months ago

0.1.14-b

7 months ago

0.1.13-b

7 months ago

0.1.12-b

7 months ago

0.1.11-b

7 months ago

0.1.10-b

7 months ago

0.1.9-b

7 months ago

0.1.8-b

7 months ago

0.1.7-b

7 months ago

0.1.6-b

7 months ago

0.1.5-b

7 months ago

0.1.4-b

7 months ago

0.1.2-b

7 months ago

0.1.1-b

7 months ago

0.1.0

7 months ago