{"id":17659737,"url":"https://github.com/raphamorim/calendario","last_synced_at":"2025-05-06T21:07:04.745Z","repository":{"id":30860303,"uuid":"34417854","full_name":"raphamorim/calendario","owner":"raphamorim","description":":calendar: Check if a day is a workday or holiday","archived":false,"fork":false,"pushed_at":"2015-08-02T06:09:15.000Z","size":543,"stargazers_count":37,"open_issues_count":3,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-06T21:06:53.538Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/calendario","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raphamorim.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-22T21:49:23.000Z","updated_at":"2022-05-19T19:24:35.000Z","dependencies_parsed_at":"2022-09-01T03:40:06.183Z","dependency_job_id":null,"html_url":"https://github.com/raphamorim/calendario","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fcalendario","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fcalendario/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fcalendario/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fcalendario/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raphamorim","download_url":"https://codeload.github.com/raphamorim/calendario/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252769420,"owners_count":21801378,"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":[],"created_at":"2024-10-23T16:08:07.837Z","updated_at":"2025-05-06T21:07:04.699Z","avatar_url":"https://github.com/raphamorim.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# calendario\n\n\u003e Check if a day is a workday or holiday.\n\n[![NPM Version](https://img.shields.io/npm/v/express.svg?style=flat)](https://www.npmjs.org/package/calendario)\n[![Build Status](https://api.travis-ci.org/raphamorim/calendario.svg)](https://travis-ci.org/raphamorim/calendario)\n[![Coverage Status](https://coveralls.io/repos/raphamorim/calendario/badge.svg?branch=master)](https://coveralls.io/r/raphamorim/calendario?branch=master)\n\nAvailable too: [brazilian portuguese](docs/PT-BR.md).\n\n## Install\n\nBefore anything, you need to have [node](http://nodejs.org/) and [npm](https://www.npmjs.org/) installed.\n\n```sh\n$ npm install calendario\n```\n\n## Usage\n\n**Available for:**\n\n- Brazil `.use('BR')`\n  - [See usage for brazilian states](docs/BR/states.md)\n- United States of America `.use('US')`\n  - [See usage for U.S. states and territories](docs/US/states.md)\n\nYou can set the calendar using `use()`\n\n```javascript\nvar calendario = require('calendario');\ncalendario.use('BR');\n```\n\nSetting the calendar for a specific state\n\n```javascript\nvar calendario = require('calendario');\ncalendario.use('US-NY');\n```\n\nYou can create your owns calendars, passing a array of objects like these:\n\n```javascript\nvar calendario = require('calendario');\n\ncalendario.use('MozillaCalendar', [\n\t{date: new Date('2020-11-25'), workday: true, summary: \"Mozilla Summit\"},\n\t{date: new Date('2021-1-20'), workday: true, summary: \"Mozilla another event\"}\n]);\n\ncalendario.use('GoogleCalendar', function(set) {\n\tset([\n\t\t{date: new Date('2017-6-3'), workday: true, summary: \"Google IO\"},\n\t\t{date: new Date('2018-10-5'), workday: true, summary: \"Google another event\"},\n\t]);\n});\n```\n\nYou can create your own calendar, passing a `ics` file\n\n```javascript\nvar calendario = require('calendario');\ncalendario.use('BR', {file: 'pt-br.ics', parser: 'ics'});\n```\n\n\n## Methods\n\n#### isWorkday\n\nVerify if the day in question is a working day, based on defined calendar sources:\n\n```javascript\nvar calendario = require('calendario');\ncalendario.use('BR');\n\ncalendario.isWorkday(new Date('2015-05-01')); // false\ncalendario.isWorkday(new Date('2015-05-02')); // true\n```\n\n#### aboutDay\n\nGet all events about specified day:\n\n```javascript\nvar calendario = require('calendario');\ncalendario.use('US');\n\ncalendario.aboutDay(new Date('2015-12-25'))\n/*\n[ { date: Fri Dec 25 2015 00:00:00 GMT-0200 (BRST),\n    summary: 'Christmas Day',\n    workday: false } ]\n*/\n```\n\n#### range\n\nGet all events from a specified begin to a specified end:\n\n```javascript\nvar calendario = require('calendario');\ncalendario.use('US');\n\nvar range = calendario.range()\n\t\t.begin(new Date('2015-12-20'))\n\t\t.end(new Date('2016-01-05'))\n\t\t.toArray();\n\n/*\n[ { date: Thu Dec 24 2015 00:00:00 GMT-0200 (BRST),\n    summary: 'Christmas Eve (from 2pm)',\n    workday: false },\n  { date: Fri Dec 25 2015 00:00:00 GMT-0200 (BRST),\n    summary: 'Christmas Day',\n    workday: false },\n  { date: Thu Dec 31 2015 00:00:00 GMT-0200 (BRST),\n    summary: 'New Year\\'s Eve (from 2pm)',\n    workday: false },\n  { date: Fri Jan 01 2016 00:00:00 GMT-0200 (BRST),\n    summary: 'New Year\\'s Day',\n    workday: false } ]\n*/\n```\n\n#### sourceList\n\nReturn all defined calendars as source:\n\n```javascript\nvar calendario = require('calendario');\ncalendario.use('US');\ncalendario.use('BR');\n\ncalendario.sourceList(); // ['US', 'BR']\n```\n\n#### eventList\n\nReturn the events from all sources:\n\n```javascript\nvar calendario = require('calendario');\ncalendario.use('MozillaCalendar', [\n\t{date: new Date('2020-11-25'), workday: true, summary: \"Mozilla Summit\"},\n\t{date: new Date('2021-1-20'), workday: true, summary: \"Mozilla another event\"}\n]);\n\ncalendario.eventList();\n/*\n[ { workday: true,\n    summary: 'Mozilla Summit',\n    date: Tue Nov 24 2020 22:00:00 GMT-0200 (BRST) },\n  { workday: true,\n    summary: 'Mozilla another event',\n    date: Wed Jan 20 2021 00:00:00 GMT-0200 (BRST) } ]\n*/\n```\n\n#### clear\n\nClear and remove all previously defined sources:\n\n```javascript\nvar calendario = require('calendario');\ncalendario.use('BR'); // Sources: ['BR']\ncalendario.clear(); // Sources: []\n```\n\n#### ignoreWeekends\n\nBy default the calendario don't consider weekends as workdays. However you can change this using:\n\n```javascript\nvar calendario = require('calendario');\ncalendario.ignoreWeekends();\n```\n\n## Data Source\n\n#### Brazil\n\n- National Events: Google Calendar; ID: `pt-br.brazilian#holiday@group.v.calendar.google.com`\n- Regional Events: [Wikipedia](http://pt.wikipedia.org/wiki/Feriados_no_Brasil#Festas_m.C3.B3veis)\n\n#### United States of America\n\n- National Events: Google Calendar; ID: `en.usa#holiday@group.v.calendar.google.com`\n- Regional Events: [Wikipedia](http://en.wikipedia.org/wiki/Public_holidays_in_the_United_States#Legal_holidays_by_states_and_political_divisions_of_the_United_States)\n\n\n## History\n\nSee [Changelog](docs/changelog/changelog.md) for more details.\n\n## Contributing\n\nDon't be shy, send a Pull Request! Here is how:\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -m 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n## About\n\n**License:** MIT ® [Raphael Amorim](https://github.com/raphamorim)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphamorim%2Fcalendario","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraphamorim%2Fcalendario","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphamorim%2Fcalendario/lists"}