{"id":13681036,"url":"https://github.com/rubencodes/recal","last_synced_at":"2025-04-09T23:18:30.425Z","repository":{"id":57349113,"uuid":"128263318","full_name":"rubencodes/recal","owner":"rubencodes","description":"A minimal, accessible React/Preact calendar component using modern CSS.","archived":false,"fork":false,"pushed_at":"2018-06-01T20:58:35.000Z","size":355,"stargazers_count":191,"open_issues_count":1,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T23:18:25.520Z","etag":null,"topics":["calendar","calendar-component","css-grid","javascript-dates","picker","preact","range-picker","react"],"latest_commit_sha":null,"homepage":"https://rubencodes.github.io/recal","language":"JavaScript","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/rubencodes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-05T20:55:53.000Z","updated_at":"2024-03-06T19:23:16.000Z","dependencies_parsed_at":"2022-09-01T21:03:03.474Z","dependency_job_id":null,"html_url":"https://github.com/rubencodes/recal","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubencodes%2Frecal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubencodes%2Frecal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubencodes%2Frecal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubencodes%2Frecal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rubencodes","download_url":"https://codeload.github.com/rubencodes/recal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125593,"owners_count":21051771,"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":["calendar","calendar-component","css-grid","javascript-dates","picker","preact","range-picker","react"],"created_at":"2024-08-02T13:01:25.321Z","updated_at":"2025-04-09T23:18:30.401Z","avatar_url":"https://github.com/rubencodes.png","language":"JavaScript","readme":"\u003cdiv align=\"center\"\u003e\n  \u003cbr /\u003e\u003cbr /\u003e\n  \u003cimg alt=\"recal logo\" src=\"https://github.com/rubencodes/recal/raw/master/docs/logo.png\" height=\"150\" /\u003e\n  \u003cbr /\u003e\u003cbr /\u003e\n\u003c/div\u003e\n\n# 📅 recal 📅\n![npm version](https://img.shields.io/npm/v/recal.svg)\n![license](https://img.shields.io/github/license/rubencodes/recal.svg)\n![bundle size](https://img.shields.io/bundlephobia/minzip/recal.svg)\n[![Lighthouse score: 100/100](https://lighthouse-badge.appspot.com/?score=100\u0026compact\u0026category=A11y)](https://github.com/ebidel/lighthouse-badge)\n\n\u003eA minimal, accessible React/Preact calendar component using modern CSS, for modern browsers. *Now with a 100 Lighthouse Accessibility Audit score.* It works with native Javascript dates, so there's no need to import any heavy dependencies like `moment`. For a set of functions for working with Javascript Dates, we recommend [`date-fns`](https://date-fns.org). For a more flexible, fully-featured set of calendar components, see [`react-dates`](https://github.com/airbnb/react-dates).\n\n\u003cbr /\u003e\n\u003cimg alt=\"example calendar\" src=\"https://github.com/rubencodes/recal/raw/master/docs/example.png\" height=\"370\" /\u003e\n\n[**See a Live Demo**](https://rubencodes.github.io/recal)\n\n[**Try on CodePen**](https://codepen.io/rubencodes/pen/PRQzPo/)\n\n## Installation\nUsing recal is simple. Just install the npm package:\n\n```bash\nnpm i -S recal\n```\n\nOr, import recal and its stylesheet via CDN:\n\n```html\n\u003clink rel=\"stylesheet\" type=\"text/css\" href=\"https://unpkg.com/recal/lib/index.css\" /\u003e\n\u003cscript src=\"https://unpkg.com/recal\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nIf you're using recal from npm, be sure to import the necessary modules into the file you wish to use it in.\n\n```javascript\n// You can use React or Preact here—just make sure you have the proper aliasing.\nimport React from 'react';\n\n// Calendar components.\nimport { DatePicker, DateRangePicker } from 'recal';\n\n// Stylesheet for calendar.\nimport 'recal/lib/index.css';\n```\n\n### Date Picker\n\nTo create a single date picker, use the `DatePicker` component as follows:\n\n```javascript\nclass MyDatePicker extends React.Component {\n  state = {};\n\n  onDateSelected = (selectedDate) =\u003e {\n    this.setState({\n      selectedDate\n    });\n  }\n\n  render() {\n    return (\n      \u003cDatePicker\n        date={ this.state.selectedDate }\n        onDateSelected={ this.onDateSelected } /\u003e\n    );\n  }\n}\n```\n\n### Date Range Picker\n\nTo create a date range picker, use the `DateRangePicker` component as follows:\n\n```javascript\nclass MyDateRangePicker extends React.Component {\n  state = {};\n\n  onStartDateSelected = (startDate) =\u003e {\n    this.setState({\n      startDate\n    });\n  }\n  onEndDateSelected = (endDate) =\u003e {\n    this.setState({\n      endDate\n    });\n  }\n\n  render() {\n    return (\n      \u003cDateRangePicker\n        startDate={ this.state.startDate }\n        endDate={ this.state.endDate }\n        onStartDateSelected={ this.onStartDateSelected }\n        onEndDateSelected={ this.onEndDateSelected } /\u003e\n    );\n  }\n}\n```\n\n### Options\n\nBoth calendars have some required and some optional props.\n\n```javascript\n// Used by DatePicker\nselectedDate: PropTypes.instanceOf(Date),\nonDateSelected: PropTypes.func,\n\n// Used by DateRangePicker\nstartDate: PropTypes.instanceOf(Date),\nendDate: PropTypes.instanceOf(Date),\nonStartDateSelected: PropTypes.func,\nonEndDateSelected: PropTypes.func,\n\n// Used by either (optional)\nonDateHovered: PropTypes.func,\nonDateFocused: PropTypes.func,\nisDateHighlighted: PropTypes.func,\nisDateEnabled: PropTypes.func,\nlocale: PropTypes.string,\ndisabled: PropTypes.bool\n```\n\n## Localization\n\nUse the `locale` string prop on the calendar components to localize the month and days of the week into other languages *(e.g. \"en-US\", \"es-MX\", etc.)*.\n\n## Accessibility\n\nThis set of calendars are optimized for screen readers as well as for keyboard-based navigation. The following shortcuts are available when the calendar is focused:\n\n| Key               | Direction | Time    |\n| ------------------| ----------| --------|\n| Left Arrow        | Back      | 1 day   |\n| Right Arrow       | Forward   | 1 day   |\n| Up Arrow          | Back      | 1 week  |\n| Down Arrow        | Forward   | 1 week  |\n| Page Up           | Back      | 1 month |\n| Page Down         | Forward   | 1 month |\n| Shift + Page Up   | Back      | 1 year  |\n| Shift + Page Down | Forward   | 1 year  |\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubencodes%2Frecal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubencodes%2Frecal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubencodes%2Frecal/lists"}