{"id":19623801,"url":"https://github.com/appleple/assign-holiday","last_synced_at":"2025-10-11T19:38:38.637Z","repository":{"id":57185167,"uuid":"397910561","full_name":"appleple/assign-holiday","owner":"appleple","description":"Simple library for adding class attributes to holiday elements in a calendar","archived":false,"fork":false,"pushed_at":"2024-03-01T05:25:15.000Z","size":472,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-09-17T04:10:48.350Z","etag":null,"topics":["calendar","npm"],"latest_commit_sha":null,"homepage":"","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/appleple.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":"2021-08-19T10:54:05.000Z","updated_at":"2024-03-05T02:39:32.000Z","dependencies_parsed_at":"2022-09-14T10:02:24.713Z","dependency_job_id":null,"html_url":"https://github.com/appleple/assign-holiday","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleple%2Fassign-holiday","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleple%2Fassign-holiday/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleple%2Fassign-holiday/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleple%2Fassign-holiday/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appleple","download_url":"https://codeload.github.com/appleple/assign-holiday/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224096503,"owners_count":17255103,"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","npm"],"created_at":"2024-11-11T11:35:31.961Z","updated_at":"2025-10-11T19:38:33.615Z","avatar_url":"https://github.com/appleple.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Assign Holiday\n[![CICD](https://github.com/appleple/assign-holiday/actions/workflows/release.yml/badge.svg)](https://github.com/appleple/assign-holiday/actions/workflows/release.yml)\n[![npm version](https://badge.fury.io/js/assign-holiday.svg)](https://badge.fury.io/js/assign-holiday)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\u003cimg src=\"/docs/images/logo-assignholiday.png\" alt=\"Logo of AssignHoliday\" width=\"150\"\u003e\n\nSimple library for adding class attributes to holiday elements in a calendar\n\n\n## Installation\n\n### Vanilla (Plain JavaScript)\n\n#### via npm\n```sh\nnpm install assign-holiday\n```\n\n#### via yarn\n```sh\nyarn add assign-holiday\n```\n\n#### via cdn\n\n```html\n\u003clink rel=\"stylesheet\" href=\"https://unpkg.com/assign-holiday@latest/dist/assign-holiday.css\"\u003e\n\u003cscript src=\"https://unpkg.com/assign-holiday@latest/dist/assign-holiday.js\"\u003e\u003c/script\u003e\n```\n\n### jQuery plugin\n#### via cdn\n```html\n\u003clink rel=\"stylesheet\" href=\"https://unpkg.com/assign-holiday@latest/dist/assign-holiday.css\"\u003e\n\u003cscript src=\"https://unpkg.com/assign-holiday@latest/dist/jquery-assign-holiday.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n### Vanilla  (Plain JavaScript)\n\n#### Basic Usage\n\n```html\n\u003ctable class=\"js-assign-holiday\"\u003e\n  \u003ctbody\u003e\n    \u003ctr data-assign-holiday-date=\"2021-12-01\"\u003e\n      \u003cth\u003e1\u003cspan class=\"assign-holiday-week-label\"\u003eWed.\u003c/span\u003e\u003c/th\u003e\n      \u003ctd class=\"assign-holiday-title\"\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr data-assign-holiday-date=\"2021-12-02\"\u003e\n      \u003cth\u003e2\u003cspan class=\"assign-holiday-week-label\"\u003eThu.\u003c/span\u003e\u003c/th\u003e\n      \u003ctd class=\"assign-holiday-title\"\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr data-assign-holiday-date=\"2021-12-03\"\u003e\n      \u003cth\u003e2\u003cspan class=\"assign-holiday-week-label\"\u003eFri.\u003c/span\u003e\u003c/th\u003e\n      \u003ctd class=\"assign-holiday-title\"\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    ...\n  \u003c/tbody\u003e\n\u003c/table\u003e\n```\n\n```javascript\nimport AssignHoliday from 'assign-holiday';\nimport \"assign-holiday/dist/assign-holiday.css\"; // if use tooltip, you need to import css\n\nconst assignHoliday = new AssignHoliday('.js-assign-holiday');\nassignHoliday.run({\n  '2021-12-06': 'Closed on Monday.',\n  '2021-12-13': 'Closed on Monday.',\n  '2021-12-20': 'Closed on Monday.',\n  '2021-12-24': {\n    title: 'Closed for Christmas Eve.',\n    className: 'is-christmas-eve', // className is only applicable on 2021-12-24.\n  },\n  '2021-12-27': 'Closed on Monday.',\n})\n```\n\n#### Example of national holidays\n```javascript\nimport AssignHoliday from 'assign-holiday';\nimport \"assign-holiday/dist/assign-holiday.css\"; // if use tooltip, you need to import css\n\nfetch('https://holidays-jp.github.io/api/v1/date.json')\n      .then(res =\u003e res.json())\n      .then(data =\u003e {\n        new AssignHoliday('.js-assign-holiday').run(data);\n      })\n```\n\n### jQuery\n\n#### Basic Usage\n\n```javascript\n$(function () {\n  const assignHoliday = $('.js-assign-holiday').assignHoliday();\n\n  assignHoliday.run({\n    '2021-12-06': 'Closed on Monday.',\n    '2021-12-13': 'Closed on Monday.',\n    '2021-12-20': 'Closed on Monday.',\n    '2021-12-24': {\n      title: 'Closed for Christmas Eve.',\n      className: 'is-christmas-eve', // className is only applicable on 2021-12-24.\n    },\n    '2021-12-27': 'Closed on Monday.',\n  })\n});\n```\n\n#### Example of national holidays\n```javascript\n$.get('https://holidays-jp.github.io/api/v1/date.json')\n  .then((data) =\u003e {\n    $('.js-assign-holiday').assignHoliday().run(data);\n  })\n```\n## Options\n| name | description | default |\n|:---|:---|:---|\n| holidayClass | Classname to be added to holiday element. | 'assign-holiday' |\n| dateAttribute | AttributeName to be set the date. | 'data-assign-holiday-date' |\n| holidayTitleClass | Classname to be added to the element to which the title will be added. | 'assign-holiday-title' |\n| holidayTitleTag | Tagname to be set to holiday title when adding holiday title. | '' |\n| holidayTitleAppendClass | classname to be added to the holiday title tag. | '' |\n| today | Whether to add a class to today's date element. | false |\n| todayClass | Classname to be added to today's date element. | 'assign-holiday-today' |\n| holidayLabel | Label to be replaced or inserted with labels of days of the week set in weekLabel. | 'Hol.' |\n| holidayLabelPosition | Position to insert the holiday label into the label for the set day of the week. You can select 'replace', 'before' or 'after'. | 'replace' |\n| weekLabelClass | Classname to be added to the element to which the holiday label will be replaced or inserted. | 'assign-holiday-week-label' |\n| weekLabels | Day of the week labels which replaced by holiday label or inserted before and after holiday label. | ['Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.', 'Sun.'] |\n| holidayTooltipClass | Classname to be added to the element to which the tooltip will be added. | 'assign-holiday-tooltip' |\n| holidayTooltipTextClass | Classname to be added to tooltip text element. | 'assign-holiday-tooltip-text' |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappleple%2Fassign-holiday","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappleple%2Fassign-holiday","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappleple%2Fassign-holiday/lists"}