{"id":13400568,"url":"https://github.com/Hacker0x01/react-datepicker","last_synced_at":"2025-03-14T06:31:44.399Z","repository":{"id":18042732,"uuid":"21088356","full_name":"Hacker0x01/react-datepicker","owner":"Hacker0x01","description":"A simple and reusable datepicker component for React","archived":false,"fork":false,"pushed_at":"2025-03-03T20:46:35.000Z","size":152856,"stargazers_count":8210,"open_issues_count":305,"forks_count":2251,"subscribers_count":83,"default_branch":"main","last_synced_at":"2025-03-05T07:04:45.002Z","etag":null,"topics":["date-fns","datepicker-component","hacktoberfest","javascript","moment","picker","react"],"latest_commit_sha":null,"homepage":"https://reactdatepicker.com/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Hacker0x01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-06-22T07:40:48.000Z","updated_at":"2025-03-04T17:48:38.000Z","dependencies_parsed_at":"2024-06-17T08:42:02.114Z","dependency_job_id":"141698e6-90b5-4223-9a34-64ec0d91b948","html_url":"https://github.com/Hacker0x01/react-datepicker","commit_stats":{"total_commits":3512,"total_committers":472,"mean_commits":7.440677966101695,"dds":0.6708428246013667,"last_synced_commit":"407051c9d0b885c66f857c56af2037e45c66d2ae"},"previous_names":[],"tags_count":221,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hacker0x01%2Freact-datepicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hacker0x01%2Freact-datepicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hacker0x01%2Freact-datepicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hacker0x01%2Freact-datepicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hacker0x01","download_url":"https://codeload.github.com/Hacker0x01/react-datepicker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242945826,"owners_count":20210763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["date-fns","datepicker-component","hacktoberfest","javascript","moment","picker","react"],"created_at":"2024-07-30T19:00:53.418Z","updated_at":"2025-03-14T06:31:44.382Z","avatar_url":"https://github.com/Hacker0x01.png","language":"TypeScript","readme":"# React Date Picker\n\n[![npm version](https://badge.fury.io/js/react-datepicker.svg)](https://badge.fury.io/js/react-datepicker)\n[![Test suite](https://github.com/Hacker0x01/react-datepicker/actions/workflows/test.yml/badge.svg)](https://github.com/Hacker0x01/react-datepicker/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/Hacker0x01/react-datepicker/branch/main/graph/badge.svg)](https://codecov.io/gh/Hacker0x01/react-datepicker)\n[![Downloads](https://img.shields.io/npm/dm/react-datepicker.svg)](https://npmjs.org/package/react-datepicker)\n\nA simple and reusable Datepicker component for React ([Demo](https://reactdatepicker.com/))\n\n![](https://cloud.githubusercontent.com/assets/1412392/5339491/c40de124-7ee1-11e4-9f07-9276e2545f27.png)\n\n## Installation\n\nThe package can be installed via [npm](https://github.com/npm/cli):\n\n```\nnpm install react-datepicker --save\n```\n\nOr via [yarn](https://github.com/yarnpkg/yarn):\n\n```\nyarn add react-datepicker\n```\n\nYou’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).\n\n```js\nimport React, { useState } from \"react\";\nimport DatePicker from \"react-datepicker\";\n\nimport \"react-datepicker/dist/react-datepicker.css\";\n\n// CSS Modules, react-datepicker-cssmodules.css\n// import 'react-datepicker/dist/react-datepicker-cssmodules.css';\n\nconst Example = () =\u003e {\n  const [startDate, setStartDate] = useState(new Date());\n  return \u003cDatePicker selected={startDate} onChange={(date) =\u003e setStartDate(date)} /\u003e;\n};\n```\n\n## Configuration\n\nThe most basic use of the DatePicker can be described with:\n\n```js\n\u003cDatePicker selected={startdate} onChange={(date) =\u003e setStartDate(date)} /\u003e\n```\n\nYou can use `onSelect` event handler which fires each time some calendar date has been selected\n\n```js\n\u003cDatePicker\n  selected={date}\n  onSelect={handleDateSelect} //when day is clicked\n  onChange={handleDateChange} //only when value has changed\n/\u003e\n```\n\n`onClickOutside` handler may be useful to close datepicker in `inline` mode\n\nSee [here](https://github.com/Hacker0x01/react-datepicker/blob/main/docs/datepicker.md) for a full list of props that may be passed to the component. Examples are given on the [main website](https://hacker0x01.github.io/react-datepicker).\n\n### Time picker\n\nYou can also include a time picker by adding the showTimeSelect prop\n\n```js\n\u003cDatePicker selected={date} onChange={handleDateChange} showTimeSelect dateFormat=\"Pp\" /\u003e\n```\n\nTimes will be displayed at 30-minute intervals by default (default configurable via timeIntervals prop)\n\nMore examples of how to use the time picker are given on the [main website](https://hacker0x01.github.io/react-datepicker)\n\n### Localization\n\nThe date picker relies on [date-fns internationalization](https://date-fns.org/v3.3.1/docs/I18n) 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:\n\n- **registerLocale** (string, object): loads an imported locale object from date-fns\n- **setDefaultLocale** (string): sets a registered locale as the default for all datepicker instances\n- **getDefaultLocale**: returns a string showing the currently set default locale\n\n```js\nimport { registerLocale, setDefaultLocale } from  \"react-datepicker\";\nimport { es } from 'date-fns/locale/es';\nregisterLocale('es', es)\n\n\u003cDatePicker\n  locale=\"es\"\n/\u003e\n```\n\nLocales can be changed in the following way:\n\n- **Globally** - `setDefaultLocale('es');`\n\n## Compatibility\n\n### React\n\nWe're always trying to stay compatible with the latest version of React. We can't support all older versions of React.\n\nLatest compatible versions:\n\n- React 16 or newer: React-datepicker v2.9.4 and newer\n- React 15.5: React-datepicker v2.9.3\n- React 15.4.1: needs React-datepicker v0.40.0, newer won't work (due to react-onclickoutside dependencies)\n- React 0.14 or newer: All above React-datepicker v0.13.0\n- React 0.13: React-datepicker v0.13.0\n- pre React 0.13: React-datepicker v0.6.2\n\n### Moment.js\n\nUp 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](https://reactdatepicker.com) for up to date examples.\n\n### Browser Support\n\nThe date picker is compatible with the latest versions of Chrome, Firefox, and IE10+.\n\nUnfortunately, 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](https://www.npmjs.com/package/classlist-polyfill) is needed, but this may change or break at any point in the future.\n\n## Local Development\n\nThe `main` branch contains the latest version of the Datepicker component.\n\nTo begin local development:\n\n1. Run `yarn install` from project root\n2. Run `yarn build` from project root\n3. Run `yarn start` from project root\n\nThe last step starts documentation app as a simple webserver on http://localhost:5173.\n\nYou 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.\n\nPlease refer to `CONTRIBUTING.md` file for more details about getting set up.\n\n### The examples\n\nThe 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.\n\n## Accessibility\n\n### Keyboard support\n\n- _Left_: Move to the previous day.\n- _Right_: Move to the next day.\n- _Up_: Move to the previous week.\n- _Down_: Move to the next week.\n- _PgUp_: Move to the previous month.\n- _Shift+PgUp_: Move to the same day and month of the previous year. If that day does not exist, moves focus to the last day of the month.\n- _PgDn_: Move to the next month.\n- _Shift+PgDn_: Move to the same day and month of the next year. If that day does not exist, moves focus to the last day of the month.\n- _Home_: Move to the first day (e.g Sunday) of the current week.\n- _End_: Move to the last day (e.g. Saturday) of the current week.\n- _Enter/Esc/Tab_: close the calendar. (Enter \u0026 Esc calls preventDefault)\n\n#### For month picker\n\n- _Left_: Move to the previous month.\n- _Right_: Move to the next month.\n- _Enter_: Select date and close the calendar\n\n## License\n\nCopyright (c) 2014-2025 HackerOne Inc. and individual contributors. Licensed under MIT license, see [LICENSE](LICENSE) for the full license.\n","funding_links":[],"categories":["Uncategorized","UI Components","TypeScript","Awesome React","Input Components","JavaScript","Demos","\u003csummary\u003eUI Components\u003c/summary\u003e","React"],"sub_categories":["Uncategorized","Form Components","Tools","React Components"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHacker0x01%2Freact-datepicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHacker0x01%2Freact-datepicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHacker0x01%2Freact-datepicker/lists"}