{"id":22694476,"url":"https://github.com/jiangweixian/dayjs-plugin-calendar-sets","last_synced_at":"2025-04-13T01:22:39.859Z","repository":{"id":52128067,"uuid":"321405792","full_name":"JiangWeixian/dayjs-plugin-calendar-sets","owner":"JiangWeixian","description":"dayjs plugin generate calendar set data","archived":false,"fork":false,"pushed_at":"2023-02-05T08:21:06.000Z","size":703,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-19T11:40:02.616Z","etag":null,"topics":["calendar","dayjs","dayjs-plugin"],"latest_commit_sha":null,"homepage":"","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/JiangWeixian.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":"2020-12-14T16:23:15.000Z","updated_at":"2023-02-05T08:20:07.000Z","dependencies_parsed_at":"2023-02-18T22:31:07.106Z","dependency_job_id":null,"html_url":"https://github.com/JiangWeixian/dayjs-plugin-calendar-sets","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiangWeixian%2Fdayjs-plugin-calendar-sets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiangWeixian%2Fdayjs-plugin-calendar-sets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiangWeixian%2Fdayjs-plugin-calendar-sets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiangWeixian%2Fdayjs-plugin-calendar-sets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JiangWeixian","download_url":"https://codeload.github.com/JiangWeixian/dayjs-plugin-calendar-sets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228996064,"owners_count":18003633,"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","dayjs","dayjs-plugin"],"created_at":"2024-12-10T03:08:21.259Z","updated_at":"2024-12-10T03:08:21.978Z","avatar_url":"https://github.com/JiangWeixian.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dayjs-plugin-calendar-sets\n\n## install\n\n```sh\nnpm install dayjs-plugin-calendar-sets dayjs --save\nnpm install dayjs --save\n```\n\n## usage\n\n### `CalendarSets`\n\n```ts\nimport CalendarSets from 'dayjs-plugin-calendar-sets'\n\ndayjs.extend(CalendarSets)\nconst sets = dayjs.calendarSets()\n```\n\nparams of `calendarSets()`\n\n- `month` - define current `month`\n- `year` - define current `year`\n- `format` - default item type of `month()`, default format into `YYYY-MM-DD`\n\n### `month`\n\ngenerate array of month dates\n\n```ts\nimport dayjs from 'dayjs'\nimport CalendarSets from 'dayjs-plugin-calendar-sets'\n\ndayjs.extend(CalendarSets)\n// get 11th month data\nconst sets = dayjs.calendarSets().month({ month: 11 })\n```\n\nparams is\n\n- `month`, month index start from `0`\n- `year`, current year, default is `this year`\n- `chunked`, creates an array of dates split into groups the length of `7`, default `true`\n\nwill generate month data like \n\n```ts\n[\n  [\n    '',\n    '2020-12-01',\n    '2020-12-02',\n    '2020-12-03',\n    '2020-12-04',\n    '2020-12-05',\n    '2020-12-06'\n  ],\n  [\n    '2020-12-07',\n    '2020-12-08',\n    '2020-12-09',\n    '2020-12-10',\n    '2020-12-11',\n    '2020-12-12',\n    '2020-12-13'\n  ],\n  [\n    '2020-12-14',\n    '2020-12-15',\n    '2020-12-16',\n    '2020-12-17',\n    '2020-12-18',\n    '2020-12-19',\n    '2020-12-20'\n  ],\n  [\n    '2020-12-21',\n    '2020-12-22',\n    '2020-12-23',\n    '2020-12-24',\n    '2020-12-25',\n    '2020-12-26',\n    '2020-12-27'\n  ],\n  [ '2020-12-28', '2020-12-29', '2020-12-30', '2020-12-31' ]\n]\n```\n\n### `year`\n\ngenerate `object` of year dates\n\n```ts\n// get 2020 year data\nconst sets = dayjs.calendarSets().year({ year: 2020 })\n```\n\nparams:\n\n- `year`, define current year\n- `chunked`, each month dates will split into groups the length of `7`, default `true`\n\n### `current`\n\n```ts\nconst sets = dayjs.calendarSets().current()\n```\n\ngenerate array of current `year-month` dates\n\nparams:\n\n- `chunked`, creates an array of dates split into groups the length of `7`, default `true`\n\n### `next` and `prev`\n\ngenerate array of prev or next `year-month` dates\n\n```ts\nconst instance = dayjs.calendarSets({ month: 11, year: 2020 })\ninstance.prev()\ninstance.next()\n```\n\n*if increase `month=11`, will also increase `year` at same time*\n\n- `type`, default `month`\n  - if `type` = `year`, will `increase or decrease` year\n- `chunked`, each month dates will split into groups the length of `7`, default `true`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiangweixian%2Fdayjs-plugin-calendar-sets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjiangweixian%2Fdayjs-plugin-calendar-sets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiangweixian%2Fdayjs-plugin-calendar-sets/lists"}