A simple and reusable datepicker component for React

Overview

React Date Picker

npm version Test suite Dependency Status codecov Downloads Code Quality: Javascript Total Alerts

A simple and reusable Datepicker component for React (Demo)

Installation

The package can be installed via npm:

npm install react-datepicker --save

Or via yarn:

yarn add react-datepicker

You’ll need to install React and PropTypes separately since those dependencies aren’t included in the package. If you need to use a locale other than the default en-US, you'll also need to import that into your project from date-fns (see Localization section below). Below is a simple example of how to use the Datepicker in a React view. You will also need to require the CSS file from this package (or provide your own). The example below shows how to include the CSS from this package if your build system supports requiring CSS files (Webpack is one that does).

import React, { useState } from "react";
import DatePicker from "react-datepicker";

import "react-datepicker/dist/react-datepicker.css";

// CSS Modules, react-datepicker-cssmodules.css
// import 'react-datepicker/dist/react-datepicker-cssmodules.css';

const Example = () => {
  const [startDate, setStartDate] = useState(new Date());
  return (
    <DatePicker selected={startDate} onChange={date => setStartDate(date)} />
  );
};

Configuration

The most basic use of the DatePicker can be described with:

<DatePicker selected={startdate} onChange={date => setStartDate(date)} />

You can use onSelect event handler which fires each time some calendar date has been selected

<DatePicker
  selected={date}
  onSelect={handleDateSelect} //when day is clicked
  onChange={handleDateChange} //only when value has changed
/>

onClickOutside handler may be useful to close datepicker in inline mode

See here for a full list of props that may be passed to the component. Examples are given on the main website.

Time picker

You can also include a time picker by adding the showTimeSelect prop

<DatePicker
  selected={date}
  onChange={handleDateChange}
  showTimeSelect
  dateFormat="Pp"
/>

Times will be displayed at 30-minute intervals by default (default configurable via timeIntervals prop)

More examples of how to use the time picker are given on the main website

Localization

The date picker relies on date-fns internationalization to localize its display components. By default, the date picker will use the locale globally set, which is English. Provided are 3 helper methods to set the locale:

  • registerLocale (string, object): loads an imported locale object from date-fns
  • setDefaultLocale (string): sets a registered locale as the default for all datepicker instances
  • getDefaultLocale: returns a string showing the currently set default locale
import { registerLocale, setDefaultLocale } from  "react-datepicker";
import es from 'date-fns/locale/es';
registerLocale('es', es)

<DatePicker
  locale="es"
/>

Locales can be changed in the following way:

  • Globally - setDefaultLocale('es');

Compatibility

React

We're always trying to stay compatible with the latest version of React. We can't support all older versions of React.

Latest compatible versions:

  • React 16 or newer: React-datepicker v2.9.4 and newer
  • React 15.5: React-datepicker v2.9.3
  • React 15.4.1: needs React-datepicker v0.40.0, newer won't work (due to react-onclickoutside dependencies)
  • React 0.14 or newer: All above React-datepicker v0.13.0
  • React 0.13: React-datepicker v0.13.0
  • pre React 0.13: React-datepicker v0.6.2

Moment.js

Up until version 1.8.0, this package was using Moment.js. Starting v2.0.0, we switched to using date-fns, which uses native Date objects, to reduce the size of the package. If you're switching from 1.8.0 to 2.0.0 or higher, please see the updated example above of check out the examples site for up to date examples.

Browser Support

The date picker is compatible with the latest versions of Chrome, Firefox, and IE10+.

Unfortunately, it is difficult to support legacy browsers while maintaining our ability to develop new features in the future. For IE9 support, it is known that the classlist polyfill is needed, but this may change or break at any point in the future.

Local Development

The master branch contains the latest version of the Datepicker component.

To begin local development:

  1. yarn install
  2. yarn build-dev
  3. yarn start

The last step starts documentation app as a simple webserver on http://localhost:3000.

You can run yarn test to execute the test suite and linters. To help you develop the component we’ve set up some tests that cover the basic functionality (can be found in /tests). Even though we’re big fans of testing, this only covers a small piece of the component. We highly recommend you add tests when you’re adding new functionality.

The examples

The examples are hosted within the docs folder and are ran in the simple app that loads the Datepicker. To extend the examples with a new example, you can simply duplicate one of the existing examples and change the unique properties of your example.

Accessibility

Keyboard support

  • Left: Move to the previous day.
  • Right: Move to the next day.
  • Up: Move to the previous week.
  • Down: Move to the next week.
  • PgUp: Move to the previous month.
  • PgDn: Move to the next month.
  • Home: Move to the previous year.
  • End: Move to the next year.
  • Enter/Esc/Tab: close the calendar. (Enter & Esc calls preventDefault)

For month picker

  • Left: Move to the previous month.
  • Right: Move to the next month.
  • Enter: Select date and close the calendar

License

Copyright (c) 2014-2021 HackerOne Inc. and individual contributors. Licensed under MIT license, see LICENSE for the full license.

Comments
  • Unexpected token: name (onClickOutside)

    Unexpected token: name (onClickOutside)

    Getting an error on webpack production build.

    Unexpected token: name (onClickOutside) [./node_modules/react-onclickoutside/index.js:92,0]
    

    It seems to be fixed in react-onclickoutside version 6.1.0 as mentioned here.

    https://github.com/Pomax/react-onclickoutside/issues/195

    I noticed this has recently been downgraded, but version 0.57.0 won't build for me and others.

    opened by tadjohnston 42
  • throw out RangeError('Invalid time value')

    throw out RangeError('Invalid time value')

    Expected behavior

    Hello, I want to use the component to select date, but it keeps throwing out Invalid time value error. No idea why.

    Actual behavior

    The below is where error was throw out.

      if (!isValid(originalDate)) {
        throw new RangeError('Invalid time value');
      } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
      // This ensures that when UTC functions will be implemented, locales will be compatible with them.
      // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
    

    Steps to reproduce

    <DatePicker
          selected={this.state.date}
          onChange={(value:any)=> {
         // value here is javascript date object
          this.setState({date: moment(value)})
           }}
      />
    

    I tested the above simple case, it throws the same error. Really confused.

    wontfix 
    opened by gamesover 38
  • Make datepicker compatible with redux-form

    Make datepicker compatible with redux-form

    This is a feature request. Would be great to see react-datepicker to be compatible with redux-form in a way like that:

    <Field name="birthdate" component="{DatePicker}" dateFormat="DD.MM.YYYY" showYearDropdown="{true}" />

    opened by delijah 38
  • Implement week picker component

    Implement week picker component

    fixes #2033

    Introduces the showWeekPicker setting, which allows picking a week. Internally, the date representing the week is the first day of that week. It's important that the dateFormat prop matches the locale in the sense that they have the same starting day of the week. In the same vein, the selected prop should refer to a date that's at the beginning of a week.

    Peek 2021-03-01 16-15

    Question 1: should left and right arrows navigate the months, rather than weeks? Answer: no. Question 2: should the week component be considered selected/keyboard-selected, and the styling be derived from that, or should the days be considered selected/keyboard-selected like they currently are?

    wontfix 
    opened by TiesWestendorp 37
  • Module not found: Can't resolve 'react-datepicker/dist/react-datepicker.css' in v2.9.0

    Module not found: Can't resolve 'react-datepicker/dist/react-datepicker.css' in v2.9.0

    Describe the bug Looks like the package folder is missing dist folder after 2.9.0 release causing webpack build to fail due to the missing 'react-datepicker/dist/react-datepicker.css' file

    image

    To Reproduce Steps to reproduce the behavior:

    Install 2.9.0 version and import 'react-datepicker/dist/react-datepicker.css' file in one of your components

    Desktop (please complete the following information):

    • OS: Mac

    Additional context Node: 12.9.0 NPM: 6.10.2

    bug 
    opened by hiredgun 30
  • react-datepicker interferes with react-select

    react-datepicker interferes with react-select

    Noticed a weird behavior. I use react-datepicker and react-select. When the select is opened, if i click on the datepicker, the select field closes and the datepicker opens as expected.

    But when the datepicker is open, if i try to click on the select, the select opens and the datepicker closes BUT almost instantly the select closes and datepicker opens again.

    wontfix 
    opened by gilbertKaradja 30
  • How to exclude time from the past (minTime), only if selected date is current date (minDate) ?

    How to exclude time from the past (minTime), only if selected date is current date (minDate) ?

    I found how to exclude dates from the past with minDate, I just pass minDate={moment()}

    If I set minTime={moment().hours().minutes()} it will exclude this time from all the dates.

    I need to limit user to set time in past of current day.

    I look for examples on the website, but could not find proper example.

    PS. I Appreciate all the work you do for the community!

    question wontfix 
    opened by JustFly1984 29
  • Launching V1.0

    Launching V1.0

    About a year ago, we did our latest try on launching a v1.0 version. I think it would be good to define a v1.0 version so that we can apply breaking changes when needed and show the maturity of this component.

    Our last effort in defining what should be done before we launch v1.0 was documented in https://github.com/Hacker0x01/react-datepicker/milestone/2. What do you guys think of this? Should be continue with this, create a new Milestone, or just call it a day and launch v1.0 in the current state?

    Todos:

    • [ ] Webpack2?
    • [x] Remove grunt?
    • [ ] Decide if we leave the API as it is?
    opened by martijnrusschen 25
  • Function bound to onChange receives wrong date

    Function bound to onChange receives wrong date

    When I select 2015-11-01 the function bound to onChange event gives me "2015-10-31T22:00:00.000Z".

    Code used:

    <DatePicker
        selected={this.state.startedReading}
        dateFormat="DD.MM.YYYY"
        onChange={::this.handleStartedReadingChange}
    />  
    

    I'm using 0.15.2.

    opened by janimattiellonen 25
  • Exclude out of bounds times

    Exclude out of bounds times

    Description

    Implements #1135. Use it by setting the excludeOutOfBoundsTimes prop on the DatePicker component. Example:

    <DatePicker
      selected={this.state.startDate}
      excludeOutOfBoundsTimes
      onChange={this.handleChange}
      minDate={new Date()}
      placeholderText="Click to select a date"
      showTimeSelect
    />
    

    How it works:

    • If you set a minDate or a maxDate, all times before that date's time will be deselected (if the active date matches the minDate or maxDate)
    • If you switch dates and select an available time, but then come back to the minDate or maxDate, that time will not be highlighted. I accomplished this by going to the renderTimes function of the Time component and change the base to be activeTime instead of new Date() - I hope there won't be any unexpected side effects.

    Caveat: I didn't have time to add tests, but I added examples in the documentation site.

    Result

    Min Date

    Screen Shot 2019-04-21 at 16 28 25

    Max Date

    Screen Shot 2019-04-21 at 16 28 44 wontfix 
    opened by paulrberg 24
  • ReferenceError: window is not defined

    ReferenceError: window is not defined

    Expected behavior

    it suppose to render ther calendar in server side, but when i save appear this error

    Actual behavior

    Client pings, but there's no entry for page: /_error ReferenceError: window is not defined at getLocaleObject (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-datepicker\lib\index.js:6099:3) at formatDate (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-datepicker\lib\index.js:5979:19) at safeDateFormat (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-datepicker\lib\index.js:5996:18) at DatePicker._this.renderDateInput (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-datepicker\lib\index.js:8806:154) at DatePicker.render (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-datepicker\lib\index.js:8881:14) at processChild (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-dom\cjs\react-dom-server.node.development.js:2863:18) at resolve (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-dom\cjs\react-dom-server.node.development.js:2716:5) at ReactDOMServerRenderer.render (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-dom\cjs\react-dom-server.node.development.js:3100:22) at ReactDOMServerRenderer.read (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-dom\cjs\react-dom-server.node.development.js:3059:29) at renderToString (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-dom\cjs\react-dom-server.node.development.js:3526:27) at renderPage (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\next\dist\server\render.js:319:26) at Function.getInitialProps (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\next\dist\server\document.js:65:25) at _callee$ (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\next\dist\lib\utils.js:86:30) at tryCatch (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\regenerator-runtime\runtime.js:62:40) at Generator.invoke [as _invoke] (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\regenerator-runtime\runtime.js:288:22) at Generator.prototype.(anonymous function) [as next] (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\regenerator-runtime\runtime.js:114:21) Client pings, but there's no entry for page: /_error ReferenceError: window is not defined at getLocaleObject (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-datepicker\lib\index.js:6099:3) at formatDate (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-datepicker\lib\index.js:5979:19) at safeDateFormat (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-datepicker\lib\index.js:5996:18) at DatePicker._this.renderDateInput (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-datepicker\lib\index.js:8806:154) at DatePicker.render (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-datepicker\lib\index.js:8881:14) at processChild (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-dom\cjs\react-dom-server.node.development.js:2863:18) at resolve (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-dom\cjs\react-dom-server.node.development.js:2716:5) at ReactDOMServerRenderer.render (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-dom\cjs\react-dom-server.node.development.js:3100:22) at ReactDOMServerRenderer.read (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-dom\cjs\react-dom-server.node.development.js:3059:29) at renderToString (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\react-dom\cjs\react-dom-server.node.development.js:3526:27) at renderPage (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\next\dist\server\render.js:319:26) at Function.getInitialProps (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\next\dist\server\document.js:65:25) at _callee$ (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\next\dist\lib\utils.js:86:30) at tryCatch (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\regenerator-runtime\runtime.js:62:40) at Generator.invoke [as _invoke] (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\regenerator-runtime\runtime.js:288:22) at Generator.prototype.(anonymous function) [as next] (C:\Users\user\Desktop\proyectos\portfolio-nicolas\node_modules\regenerator-runtime\runtime.js:114:21)

    Disposing inactive page(s): /callback

    Steps to reproduce

    i have a JS file with that code import React from "react"; import DatePicker from "react-datepicker";

    import "react-datepicker/dist/react-datepicker.css";

    class PortDate extends React.Component { constructor(props) { super(props); this.state = { startDate: new Date() }; this.handleChange = this.handleChange.bind(this); }

    handleChange(date) { this.setState({ startDate: date }); }

    render() { return ( <DatePicker selected={this.state.startDate} onChange={this.handleChange} /> ); } } export default PortDate;


    and have anotherone where im importing

    import PortInput from '../form/portInput';

    const validateInputs=(values)=>{ let errors = {}; // debugger;

    Object.entries(values).forEach(([key,value])=>{
        if(!values[key]){
            errors[key]=`El campo ${key} es requerido`
        }
        
    })
    
    return errors;
    

    } const INITIAL_VALUES={ startDate:'', endDate:'' } const PortfolioCreateForm = () => (

    <Formik
      initialValues={INITIAL_VALUES}
      validate={validateInputs}
      onSubmit={(values, { setSubmitting }) => {
        setTimeout(() => {
          alert(JSON.stringify(values, null, 2));
          setSubmitting(false);
        }, 400);
      }}
    >
      {({ isSubmitting }) => (
        <Form>
            <Field  type="textarea" 
                    name="startDate"
                    label='Start Date'
                    component={PortDate}/>
    
            <Field type="textarea" 
                    name="endDate"
                    label='End Date'
                    component={PortDate}/>
    
          <button type="submit" disabled={isSubmitting}>
            Create
          </button>
        </Form>
      )}
    </Formik>
    
    );

    export default PortfolioCreateForm;

    wontfix 
    opened by novenix 24
  • chore(deps-dev): bump eslint from 7.32.0 to 8.31.0

    chore(deps-dev): bump eslint from 7.32.0 to 8.31.0

    Bumps eslint from 7.32.0 to 8.31.0.

    Release notes

    Sourced from eslint's releases.

    v8.31.0

    Features

    • 52c7c73 feat: check assignment patterns in no-underscore-dangle (#16693) (Milos Djermanovic)
    • b401cde feat: add options to check destructuring in no-underscore-dangle (#16006) (Morten Kaltoft)
    • 30d0daf feat: group properties with values in parentheses in key-spacing (#16677) (Francesco Trotta)

    Bug Fixes

    • 35439f1 fix: correct syntax error in prefer-arrow-callback autofix (#16722) (Francesco Trotta)
    • 87b2470 fix: new instance of FlatESLint should load latest config file version (#16608) (Milos Djermanovic)

    Documentation

    • 4339dc4 docs: Update README (GitHub Actions Bot)
    • 4e4049c docs: optimize code block structure (#16669) (Sam Chen)
    • 54a7ade docs: do not escape code blocks of formatters examples (#16719) (Sam Chen)
    • e5ecfef docs: Add function call example for no-undefined (#16712) (Elliot Huffman)
    • a3262f0 docs: Add mastodon link (#16638) (Amaresh S M)
    • a14ccf9 docs: clarify files property (#16709) (Sam Chen)
    • 3b29eb1 docs: fix npm link (#16710) (Abdullah Osama)
    • a638673 docs: fix search bar focus on Esc (#16700) (Shanmughapriyan S)
    • f62b722 docs: country flag missing in windows (#16698) (Shanmughapriyan S)
    • 4d27ec6 docs: display zh-hans in the docs language switcher (#16686) (Percy Ma)
    • 8bda20e docs: remove manually maintained anchors (#16685) (Percy Ma)
    • b68440f docs: User Guide Getting Started expansion (#16596) (Ben Perlmutter)

    Chores

    • 65d4e24 chore: Upgrade @​eslint/eslintrc@​1.4.1 (#16729) (Brandon Mills)
    • 8d93081 chore: fix CI failure (#16721) (Sam Chen)
    • 8f17247 chore: Set up automatic updating of README (#16717) (Nicholas C. Zakas)
    • 4cd87cb ci: bump actions/stale from 6 to 7 (#16713) (dependabot[bot])
    • fd20c75 chore: sort package.json scripts in alphabetical order (#16705) (Darius Dzien)
    • 10a5c78 chore: update ignore patterns in eslint.config.js (#16678) (Milos Djermanovic)

    v8.30.0

    Features

    • 075ef2c feat: add suggestion for no-return-await (#16637) (Daniel Bartholomae)
    • 7190d98 feat: update globals (#16654) (Sébastien Règne)

    Bug Fixes

    • 1a327aa fix: Ensure flat config unignores work consistently like eslintrc (#16579) (Nicholas C. Zakas)
    • 9b8bb72 fix: autofix recursive functions in no-var (#16611) (Milos Djermanovic)

    Documentation

    • 6a8cd94 docs: Clarify Discord info in issue template config (#16663) (Nicholas C. Zakas)
    • ad44344 docs: CLI documentation standardization (#16563) (Ben Perlmutter)
    • 293573e docs: fix broken line numbers (#16606) (Sam Chen)
    • fa2c64b docs: use relative links for internal links (#16631) (Percy Ma)
    • 75276c9 docs: reorder options in no-unused-vars (#16625) (Milos Djermanovic)
    • 7276fe5 docs: Fix anchor in URL (#16628) (Karl Horky)
    • 6bef135 docs: don't apply layouts to html formatter example (#16591) (Tanuj Kanti)
    • dfc7ec1 docs: Formatters page updates (#16566) (Ben Perlmutter)

    ... (truncated)

    Changelog

    Sourced from eslint's changelog.

    v8.31.0 - December 31, 2022

    • 65d4e24 chore: Upgrade @​eslint/eslintrc@​1.4.1 (#16729) (Brandon Mills)
    • 35439f1 fix: correct syntax error in prefer-arrow-callback autofix (#16722) (Francesco Trotta)
    • 87b2470 fix: new instance of FlatESLint should load latest config file version (#16608) (Milos Djermanovic)
    • 8d93081 chore: fix CI failure (#16721) (Sam Chen)
    • 4339dc4 docs: Update README (GitHub Actions Bot)
    • 8f17247 chore: Set up automatic updating of README (#16717) (Nicholas C. Zakas)
    • 4e4049c docs: optimize code block structure (#16669) (Sam Chen)
    • 54a7ade docs: do not escape code blocks of formatters examples (#16719) (Sam Chen)
    • 52c7c73 feat: check assignment patterns in no-underscore-dangle (#16693) (Milos Djermanovic)
    • e5ecfef docs: Add function call example for no-undefined (#16712) (Elliot Huffman)
    • a3262f0 docs: Add mastodon link (#16638) (Amaresh S M)
    • 4cd87cb ci: bump actions/stale from 6 to 7 (#16713) (dependabot[bot])
    • a14ccf9 docs: clarify files property (#16709) (Sam Chen)
    • 3b29eb1 docs: fix npm link (#16710) (Abdullah Osama)
    • fd20c75 chore: sort package.json scripts in alphabetical order (#16705) (Darius Dzien)
    • a638673 docs: fix search bar focus on Esc (#16700) (Shanmughapriyan S)
    • f62b722 docs: country flag missing in windows (#16698) (Shanmughapriyan S)
    • 4d27ec6 docs: display zh-hans in the docs language switcher (#16686) (Percy Ma)
    • 8bda20e docs: remove manually maintained anchors (#16685) (Percy Ma)
    • b401cde feat: add options to check destructuring in no-underscore-dangle (#16006) (Morten Kaltoft)
    • b68440f docs: User Guide Getting Started expansion (#16596) (Ben Perlmutter)
    • 30d0daf feat: group properties with values in parentheses in key-spacing (#16677) (Francesco Trotta)
    • 10a5c78 chore: update ignore patterns in eslint.config.js (#16678) (Milos Djermanovic)

    v8.30.0 - December 16, 2022

    • f2c4737 chore: upgrade @​eslint/eslintrc@​1.4.0 (#16675) (Milos Djermanovic)
    • 1a327aa fix: Ensure flat config unignores work consistently like eslintrc (#16579) (Nicholas C. Zakas)
    • 075ef2c feat: add suggestion for no-return-await (#16637) (Daniel Bartholomae)
    • ba74253 chore: standardize npm script names per #14827 (#16315) (Patrick McElhaney)
    • 6a8cd94 docs: Clarify Discord info in issue template config (#16663) (Nicholas C. Zakas)
    • 0d9af4c ci: fix npm v9 problem with file: (#16664) (Milos Djermanovic)
    • 7190d98 feat: update globals (#16654) (Sébastien Règne)
    • ad44344 docs: CLI documentation standardization (#16563) (Ben Perlmutter)
    • 90c9219 refactor: migrate off deprecated function-style rules in all tests (#16618) (Bryan Mishkin)
    • 9b8bb72 fix: autofix recursive functions in no-var (#16611) (Milos Djermanovic)
    • 293573e docs: fix broken line numbers (#16606) (Sam Chen)
    • fa2c64b docs: use relative links for internal links (#16631) (Percy Ma)
    • 75276c9 docs: reorder options in no-unused-vars (#16625) (Milos Djermanovic)
    • 7276fe5 docs: Fix anchor in URL (#16628) (Karl Horky)
    • 6bef135 docs: don't apply layouts to html formatter example (#16591) (Tanuj Kanti)
    • dfc7ec1 docs: Formatters page updates (#16566) (Ben Perlmutter)
    • 8ba124c docs: update the prefer-const example (#16607) (Pavel)
    • e6cb05a docs: fix css leaking (#16603) (Sam Chen)

    v8.29.0 - December 2, 2022

    • 0311d81 docs: Configuring Plugins page intro, page tweaks, and rename (#16534) (Ben Perlmutter)

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • month picker keyboard selected class names issue and update solution

    month picker keyboard selected class names issue and update solution

    Describe the bug disabledKeyboardNavigation props in month picker doesn't work

    Expected behavior css and side event issues with classname

    Additional context Solution Modify line 321 of src/month.jsx as follows: !this.props.disabledKeyboardNavigation && utils.getMonth(preSelection) === m,

    opened by sanghogu 0
  • prevent show previous month when using focusSelectedMonth and showPreviousMonths

    prevent show previous month when using focusSelectedMonth and showPreviousMonths "fix for issue"

    Describe the bug The problem is happen when using focusSelectedMonth = {false} and showPreviousMonths = {false} and monthsShown={2} the date picker show previous month after clear selected values. for example: if now December it will be show December, January after clear values it show November, December. The resolving for the problem I put bottom in section: "How to fix the issue". Can you fix it and upload in next version ? If you have another work around for the problem I will be glad if you send me it.

    To Reproduce Steps to reproduce the behavior:

    code:

    ` import React from "react"; import DatePicker from './DatePicker'

    export default class App extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            startDateState: null,
            endDateState: null
        }
        console.log(`constructor`)
    }
    
    onChange = (dates) => {
        console.log(`dates`, dates)
        const [start, end] = dates
        console.log(`dates s,e`, start, end)
        this.setState({
            startDateState: start,
            endDateState: end
        });
    }
    
    
    render(){
        return(
            <div>
                <DatePicker 
                    isClearable
                    onChange={this.onChange}
                    selectsRange
                    focusSelectedMonth={false}
                    monthsShown={2}
                    minDate={new Date()}
                    startDate={this.state.startDateState}
                    endDate={this.state.endDateState}
                    shouldCloseOnSelect={false}
                    showPreviousMonths={false}
                    selected={this.state.startDateState}
                />
            </div>
        )
    }
    

    } `

    1. Go to 'datepicker'
    2. Click on 'input value select range on dates'
    3. close date picker
    4. click on "x" clean input values
    5. click on input value

    Expected behavior show previous month, instead to show December, January show November, December

    Screenshots before: image

    after clean: image

    How to fix the issue I find the problem in package. Need to set default value to method: src -> DatePicker.jsx -> DatePicker -> onClearClick set default value for monthSelectedIn method code:

    ` onClearClick = (event) => { if (event) { if (event.preventDefault) { event.preventDefault(); } } if (this.props.selectsRange) { this.props.onChange([null, null], event); } else { this.props.onChange(null, event); } this.setState({ monthSelectedIn: 0 }); this.setState({ inputValue: null }); };

    `

    Thanks Michael

    opened by michaelfedorov-realcommerce 0
  • chore(deps-dev): bump @babel/core from 7.16.5 to 7.20.7

    chore(deps-dev): bump @babel/core from 7.16.5 to 7.20.7

    Bumps @babel/core from 7.16.5 to 7.20.7.

    Release notes

    Sourced from @​babel/core's releases.

    v7.20.7 (2022-12-22)

    Thanks @​wsypower for your first PR!

    :eyeglasses: Spec Compliance

    • babel-helper-member-expression-to-functions, babel-helper-replace-supers, babel-plugin-proposal-class-properties, babel-plugin-transform-classes
    • babel-helpers, babel-plugin-proposal-class-properties, babel-plugin-transform-classes, babel-plugin-transform-object-super

    :bug: Bug Fix

    • babel-parser, babel-plugin-transform-typescript
    • babel-traverse
    • babel-plugin-transform-typescript, babel-traverse
    • babel-plugin-transform-block-scoping
    • babel-plugin-proposal-async-generator-functions, babel-preset-env
    • babel-generator, babel-plugin-proposal-optional-chaining
    • babel-plugin-transform-react-jsx, babel-types
    • babel-core, babel-helpers, babel-plugin-transform-computed-properties, babel-runtime-corejs2, babel-runtime-corejs3, babel-runtime
    • babel-helper-member-expression-to-functions, babel-helper-replace-supers, babel-plugin-proposal-class-properties, babel-plugin-transform-classes
    • babel-generator

    :nail_care: Polish

    • babel-plugin-transform-block-scoping, babel-traverse

    :house: Internal

    • babel-helper-define-map, babel-plugin-transform-property-mutators
    • babel-core, babel-plugin-proposal-class-properties, babel-plugin-transform-block-scoping, babel-plugin-transform-classes, babel-plugin-transform-destructuring, babel-plugin-transform-parameters, babel-plugin-transform-regenerator, babel-plugin-transform-runtime, babel-preset-env, babel-traverse

    :running_woman: Performance

    Committers: 6

    ... (truncated)

    Changelog

    Sourced from @​babel/core's changelog.

    v7.20.7 (2022-12-22)

    :eyeglasses: Spec Compliance

    • babel-helper-member-expression-to-functions, babel-helper-replace-supers, babel-plugin-proposal-class-properties, babel-plugin-transform-classes
    • babel-helpers, babel-plugin-proposal-class-properties, babel-plugin-transform-classes, babel-plugin-transform-object-super

    :bug: Bug Fix

    • babel-parser, babel-plugin-transform-typescript
    • babel-traverse
    • babel-plugin-transform-typescript, babel-traverse
    • babel-plugin-transform-block-scoping
    • babel-plugin-proposal-async-generator-functions, babel-preset-env
    • babel-generator, babel-plugin-proposal-optional-chaining
    • babel-plugin-transform-react-jsx, babel-types
    • babel-core, babel-helpers, babel-plugin-transform-computed-properties, babel-runtime-corejs2, babel-runtime-corejs3, babel-runtime
    • babel-helper-member-expression-to-functions, babel-helper-replace-supers, babel-plugin-proposal-class-properties, babel-plugin-transform-classes
    • babel-generator

    :nail_care: Polish

    • babel-plugin-transform-block-scoping, babel-traverse

    :house: Internal

    • babel-helper-define-map, babel-plugin-transform-property-mutators
    • babel-core, babel-plugin-proposal-class-properties, babel-plugin-transform-block-scoping, babel-plugin-transform-classes, babel-plugin-transform-destructuring, babel-plugin-transform-parameters, babel-plugin-transform-regenerator, babel-plugin-transform-runtime, babel-preset-env, babel-traverse

    :running_woman: Performance

    v7.20.6 (2022-11-28)

    :bug: Bug Fix

    v7.20.5 (2022-11-28)

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • chore(deps-dev): bump sass from 1.56.2 to 1.57.1 in /docs-site

    chore(deps-dev): bump sass from 1.56.2 to 1.57.1 in /docs-site

    Bumps sass from 1.56.2 to 1.57.1.

    Release notes

    Sourced from sass's releases.

    Dart Sass 1.57.1

    To install Sass 1.57.1, download one of the packages below and add it to your PATH, or see the Sass website for full installation instructions.

    Changes

    • No user-visible changes.

    See the full changelog for changes in earlier releases.

    Dart Sass 1.57.0

    To install Sass 1.57.0, download one of the packages below and add it to your PATH, or see the Sass website for full installation instructions.

    Changes

    • Add a split($string, $separator, $limit: null) function to sass:string that splits a string into separate substrings based on a separator string.

    JavaScript API

    • Potentially breaking bug fix: Custom functions in both the modern and legacy API now properly reject signatures with whitespace between the function name and parentheses.

    • Custom functions in the legacy API now allow signatures with whitespace before the function name, to match a bug in Node Sass.

    Dart API

    • Potentially breaking bug fix: Callable.fromSignature() and AsyncCallable.fromSignature() now reject signatures with whitespace between the function name and parentheses.

    See the full changelog for changes in earlier releases.

    Changelog

    Sourced from sass's changelog.

    1.57.1

    • No user-visible changes.

    1.57.0

    • Add a split($string, $separator, $limit: null) function to sass:string that splits a string into separate substrings based on a separator string.

    JavaScript API

    • Potentially breaking bug fix: Custom functions in both the modern and legacy API now properly reject signatures with whitespace between the function name and parentheses.

    • Custom functions in the legacy API now allow signatures with whitespace before the function name, to match a bug in Node Sass.

    Dart API

    • Potentially breaking bug fix: Callable.fromSignature() and AsyncCallable.fromSignature() now reject signatures with whitespace between the function name and parentheses.
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Is there any way to input startDate and endDate from keyboard when we use selectRange? I have tried but not working.

    Is there any way to input startDate and endDate from keyboard when we use selectRange? I have tried but not working.

    Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

    Describe the solution you'd like A clear and concise description of what you want to happen.

    Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

    Additional context Add any other context or screenshots about the feature request here.

    opened by TranDoanTriet 0
Releases(v4.8.0)
  • v4.8.0(May 17, 2022)

  • v4.7.0(May 17, 2022)

  • v4.6.0(Jan 8, 2022)

    • Fix year dropdown scroll on open
    • Accessibility: current date should use aria-current="date"
    • Accessibility: add aria-selected to current selection
    • Fix multi months on fixedHeight
    Source code(tar.gz)
    Source code(zip)
  • v4.5.0(Dec 24, 2021)

  • v4.4.0(Dec 24, 2021)

    • fix sideEffects
    • Fix isValid helper so it accepts dates equal to minDate
    • Added portalHost prop to DatePicker component
    • Add ability to exclude and include date intervals
    Source code(tar.gz)
    Source code(zip)
  • v4.3.0(Oct 21, 2021)

    • Bump date-fns to non-breaking release 2.24.0
    • Updated react-onclickoutside support shadow-dom
    • Fix aria labels for previous and next month or year
    Source code(tar.gz)
    Source code(zip)
  • v4.2.1(Aug 19, 2021)

  • v4.2.0(Aug 8, 2021)

    • fix next/prev arrow onkeydown handlers
    • Fix start of week not using the registered locale
    • Uses react dom portals for portal version when portalId is provided
    • add focusSelectedMonth docs props
    • adds keyboard navigation with accessible focus to year picker
    • Set explicit 0 width for navigation icon span container to render consistently on Safari
    • Migrate to latest Sass lib
    Source code(tar.gz)
    Source code(zip)
  • v4.1.1(Aug 8, 2021)

  • v4.1.0(May 30, 2021)

  • v4.0.0(May 29, 2021)

    New major release!

    • Upgrade react-popper to v2.x
    • Improve UX and the ability to customize on navigation icons
    • Prevent class name 'undefined' when clearButtonClassName is not provided
    • Improvements to selectsRange when not inline
    • allows the datepicker to determine the validity of a date by props.minDate
    • Upgrade react to 17.x
    • Add : start day
    Source code(tar.gz)
    Source code(zip)
  • v3.8.0(Apr 19, 2021)

    • Make the clear button customizable
    • Changed condition for renderCustomHeader with showTimeSelect prop
    • Make mindate and maxdate selectable via keyboard
    Source code(tar.gz)
    Source code(zip)
  • v3.7.0(Mar 31, 2021)

  • v3.6.0(Feb 23, 2021)

  • v3.5.0(Feb 17, 2021)

    • Fix parseDate default locale handling
    • Display custom header when monthsShown prop is bigger than 1
    • add four column month display layout flag for month picker
    • Fixing wrong weekNumber by using getIsoWeek
    • Fix Input Time input width being cut off
    Source code(tar.gz)
    Source code(zip)
  • v3.4.1(Jan 12, 2021)

  • v3.4.0(Jan 10, 2021)

    • Bind renderTime to selected date
    • Add aria properties for required, invalid and describedby
    • Scroll example to the top of the page instead of center
    • Fix accessibility issue for scrollable time panel
    • Fix accessibility issue for time selection
    • Replace fill method with different syntax for IE compatibility
    • Fix keyboard navigation in inline version
    • Add locale props to MonthYearDropdownOptions
    • Upgrade react-popper
    Source code(tar.gz)
    Source code(zip)
  • v3.3.0(Oct 30, 2020)

    • Bump dependencies
    • fix autofocus on selected day when inline prop is true
    • Hide duplicate days when monthsShown > 1
    • Update preSelection when clicking on a day
    • Add filterTime property
    • Pass pure date object to time input
    Source code(tar.gz)
    Source code(zip)
  • v3.2.2(Sep 26, 2020)

  • v3.2.1(Sep 26, 2020)

  • v3.2.0(Sep 26, 2020)

    • Reorder examples
    • fix(date_utils): fixing navigation on yearpicker (#2230)
    • Fix border radius issues (#2285)
    • Update Readme example to use Hooks (#2348)
    • Add current year class for year picker - Feature #2341 (#2344)
    • Fix crash with non-standard time intervals (#2169, #2262) (#2350)
    • Add property to show specific year item number for year picker - Feature #2331
    • Adds keyboard navigation for month picker (#2389)
    • add & call 'monthClassName' to use its value (#2410)
    • Use set for setTime (#2293)
    • Copy generated css module to file with filename format CRA expects
    Source code(tar.gz)
    Source code(zip)
  • v3.1.3(Sep 26, 2020)

  • v3.1.2(Sep 26, 2020)

  • v3.1.1(Sep 26, 2020)

  • v3.1.0(Sep 26, 2020)

    • add preventScroll option to programmatic focus (#2173)
    • Fix Datepicker crashes with non-standard time intervals (#2172)
    • Fix border bottom right time section (#2179)
    • Added wrapperClassName prop (#2197)
    • YearPicker upgrades (#2186)
    • remove inline check for keyboard selected (#2153)
    • Range on one datepicker for #584 (#2204)
    • Add closeOnScroll prop (#2209)
    • Dependency upgrades
    Source code(tar.gz)
    Source code(zip)
  • v3.0.0(Jun 4, 2020)

    Breaking change:

    • Replace inlineFocusSelectedMonth with focusSelectedMonth

    Month/Year picker:

    • Add selected class for year picker
    • Year change day selection
    • add two column month display layout flag for month picker

    Other changes:

    • Update onChangeRaw and onSelect
    • Render Popper in a Portal by Id to avoid overflow of parent
    • InputTime initial value
    • Pass arrow props to CalendarContainer
    Source code(tar.gz)
    Source code(zip)
  • v2.16.0(Jun 4, 2020)

  • v2.15.0(May 7, 2020)

  • v2.14.1(Apr 23, 2020)

  • v2.14.0(Mar 11, 2020)

Owner
HackerOne
Vulnerability disclosure should suck less.
HackerOne
Reusable date picker component for React

React DayPicker DayPicker is a reusable date picker component for React. $ npm install react-day-picker@next Beta version ⚠️ This branch is for the ne

Giampaolo Bellavite 4.8k Dec 28, 2022
An easily internationalizable, mobile-friendly datepicker library for the web

react-dates An easily internationalizable, accessible, mobile-friendly datepicker library for the web. Live Playground For examples of the datepicker

Airbnb 12k Jan 6, 2023
A refreshing JavaScript Datepicker — lightweight, no dependencies, modular CSS

Pikaday A refreshing JavaScript Datepicker Lightweight (less than 5kb minified and gzipped) No dependencies (but plays well with Moment.js) Modular CS

null 7.9k Jan 4, 2023
TheDatepicker - Pure JavaScript Datepicker 📅

Pure JavaScript Datepicker by Slevomat.cz.

The Datepicker 27 Dec 16, 2022
A project implementing a datepicker with format dd/MM/yyyy from scratch.

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

José Antônio 2 Jan 11, 2022
CalendarPickerJS - A minimalistic and modern date-picker component/library 🗓️👨🏽‍💻 Written in Vanilla JS

CalendarPickerJS The simple and pretty way to let a user select a day! Supports all major browser. Entirely written in Vanilla JavaScript with no depe

Mathias Picker 15 Dec 6, 2022
A date picker web component, and spiritual successor to duet date picker

<date-picker> A date picker web component, based on duet date picker, except authored with Lit and using shadow DOM. This is a work in progress. Todo:

Nick Williams 25 Aug 3, 2022
gcal/outlook like calendar component

react-big-calendar An events calendar component built for React and made for modern browsers (read: IE10+) and uses flexbox over the classic tables-ce

Jason Quense 6.2k Dec 29, 2022
Ultimate calendar for your React app.

React-Calendar Ultimate calendar for your React app. Pick days, months, years, or even decades Supports range selection Supports virtually any languag

Wojciech Maj 2.8k Dec 27, 2022
React Native Week Month Date Picker

React Native Week Month Date Picker Date picker with a week and month view Installation npm install react-native-week-month-date-picker Dependencies T

Noona 119 Dec 27, 2022
Lightweight and simple JS date formatting and parsing

fecha Lightweight date formatting and parsing (~2KB). Meant to replace parsing and formatting functionality of moment.js. NPM npm install fecha --save

Taylor Hakes 2k Jan 5, 2023
Simple drag and drop with dragula

Drag and drop so simple it hurts Official Angular wrapper for dragula. Notice: v2 has been released It contains a number of breaking changes. Follow t

Valor Software 1.9k Dec 18, 2022
Super simple countdowns.

Countdown.js Countdown.js is a library that allows developers to set countdowns for any kind of interaction. For example, if you would like to submit

Gumroad 399 Dec 16, 2022
Countdown - jQuery CountDown Clock - Simple countdown plugin for product special offers

TronLink Wallet Address TRX - BTC - BTT - USDT: TH9RyofE7WiDDVVFLMJgFns2ByBRmgQzNB jQuery Countdown Clock jQuery countdown plugin that accounts for ti

E-Piksel 33 Aug 30, 2022
jQuery plugin to allow dragging and dropping of elements and sorting of lists and other nested structures.

Drag and Drop Basic jQuery plugin to allow drag and drop: dragging dropping of dragged elements sorting of lists and other nested html structures (ul,

Ole Trenner 12 Aug 26, 2021
A tiny and fast zero-dependency date-picker built with vanilla Javascript and CSS.

A tiny zero-dependency and framework-agnostic date picker that is incredibly easy to use! Compatible with any web UI framework, vanilla JS projects, and even HTML-only projects!

Nezar 1 Jan 22, 2021
Parse, validate, manipulate, and display dates in javascript.

Moment.js A JavaScript date library for parsing, validating, manipulating, and formatting dates. Project Status Moment.js is a legacy project, now in

Moment.js 47.1k Jan 2, 2023
⏱ A library for working with dates and times in JS

Luxon Luxon is a library for working with dates and times in JavaScript. DateTime.now().setZone("America/New_York").minus({ weeks: 1 }).endOf("day").t

Moment.js 13.4k Jan 9, 2023
🕑 js-joda is an immutable date and time library for JavaScript.

js-joda is an immutable date and time library for JavaScript. It provides a simple, domain-driven and clean API based on the ISO8601 calendar.

null 1.5k Dec 27, 2022