{"id":16483452,"url":"https://github.com/wusb/calendar","last_synced_at":"2025-03-16T18:31:42.201Z","repository":{"id":39403129,"uuid":"203119578","full_name":"wusb/calendar","owner":"wusb","description":"📆 calendar 日历","archived":false,"fork":false,"pushed_at":"2022-12-11T03:42:07.000Z","size":2935,"stargazers_count":121,"open_issues_count":23,"forks_count":16,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-07T00:40:37.077Z","etag":null,"topics":["angular","calendar","component","date","datepicker","daypicker","mobile","picker","react","vue"],"latest_commit_sha":null,"homepage":"https://simbawus.github.io/calendar","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/wusb.png","metadata":{"files":{"readme":"README-zh_CN.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":"2019-08-19T07:20:00.000Z","updated_at":"2023-09-05T01:09:09.000Z","dependencies_parsed_at":"2023-01-26T15:01:36.866Z","dependency_job_id":null,"html_url":"https://github.com/wusb/calendar","commit_stats":null,"previous_names":["simbawus/calendar"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wusb%2Fcalendar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wusb%2Fcalendar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wusb%2Fcalendar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wusb%2Fcalendar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wusb","download_url":"https://codeload.github.com/wusb/calendar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243188204,"owners_count":20250454,"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":["angular","calendar","component","date","datepicker","daypicker","mobile","picker","react","vue"],"created_at":"2024-10-11T13:14:02.772Z","updated_at":"2025-03-16T18:31:41.540Z","avatar_url":"https://github.com/wusb.png","language":"JavaScript","readme":"# Clendar [Demo](https://simbawus.github.io/calendar)\n\n[![npm](https://img.shields.io/npm/v/calendar-lite.svg)](https://www.npmjs.com/package/calendar-lite)\n[![npm](https://img.shields.io/npm/dt/calendar-lite.svg)](https://www.npmjs.com/package/calendar-lite)\n[![GitHub license](https://img.shields.io/github/license/simbawus/calendar.svg)](https://github.com/simbawus/calendar/blob/master/LICENSE)\n\n###### [README in English](README.md)\n\n- 原生 js 开发、不依赖任何框架和库的轻量级移动端数字键盘\n- API 简洁，非常好上手\n\n![example](https://up.boohee.cn/house/u/pixiu/calendar.gif)\n\n## 属性\n\n| Property         | Type     | Default           | Description              |\n| :--------------- | :------- | :---------------- | :----------------------- |\n| el               | DOM      | -                 | 日历父节点               |\n| currentDate      | String   | today(yyyy/MM/dd) | 当前日期                 |\n| format           | String   | yyyy/MM/dd        | 日期格式                 |\n| monthFormat      | String   | yyyy年MM月     | 月份格式                 |\n| onDayClick       | Function | -                 | 点击日期时触发           |\n| onClickPreMonth  | Function | -                 | 点击箭头去上一个月时触发 |\n| onClickNextMonth | Function | -                 | 点击箭头去下一个月时触发 |\n| onMonthChange    | Function | -                 | 月份改变时触发           |\n\n## 开始上手\n\n### 使用示例\n\n```shell\nyarn add calendar-lite --dev\n```\n\n### 使用示例\n\n- **Native JavaScript**\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"UTF-8\" /\u003e\n    \u003cmeta name=\"author\" content=\"simbawu\" /\u003e\n    \u003ctitle\u003ecalendar\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cdiv id=\"values\"\u003e\u003c/div\u003e\n    \u003cdiv id=\"app\"\u003e\u003c/div\u003e\n    \u003cscript src=\"./calendar.js\"\u003e\u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n```javascript\n//calendar.js\nimport Calendar from \"calendar-lite\";\n\nfunction onDayClick(date) {\n  console.log(date); // choose date\n}\n\nnew Calendar({\n  el: document.querySelector(\"#app\"),\n  currentDate: \"2019/08/28\",\n  onDayClick\n});\n```\n\n- **React**\n\n```jsx\nimport React from \"react\";\nimport Calendar from \"calendar-lite\";\n\nclass CalendarPage extends React.Component {\n  constructor() {\n    super();\n  }\n\n  componentDidMount() {\n    this.renderCalendar();\n  }\n\n  onDayClick = date =\u003e {\n    console.log(date); // choose date\n  };\n\n  renderCalendar = () =\u003e {\n    return new Calendar({\n      el: this.refs.slideRuler,\n      currentDate: \"2019/08/28\",\n      onDayClick: this.onDayClick\n    });\n  };\n\n  render() {\n    return \u003cdiv ref=\"slideRuler\" /\u003e;\n  }\n}\n\nexport default CalendarPage;\n```\n\n- **Vue**\n\n```js\n\u003ctemplate\u003e\n  \u003cdiv\u003e\u003c/div\u003e\n\u003c/template\u003e\n\u003cscript\u003e\nimport Calendar from 'calendar-lite';\nexport default {\n  mounted () {\n    this.renderCalendar();\n  },\n  methods: () {\n    renderCalendar() {\n    \treturn new Calendar (\n        {\n          el: this.$el,\n          currentDate: \"2019/08/28\",\n          onDayClick: onDayClick\n        }\n      );\n    },\n\n    onDayClick(date) {\n      console.log(date); // choose date\n    }\n  }\n}\n\u003c/script\u003e\n```\n\n- **Angular**\n\n```typescript\nimport { Component, ViewChild, OnInit, ViewEncapsulation } from \"@angular/core\";\nimport Calendar from \"calendar-lite\";\n\n@Component({\n  selector: \"my-app\",\n  template: `\n    \u003cdiv #calendar\u003e\u003c/div\u003e\n  `,\n  encapsulation: ViewEncapsulation.None\n})\nexport class AppComponent implements OnInit {\n  @ViewChild(\"calendar\") calendar;\n\n  ngOnInit() {\n    this.renderCalendar();\n  }\n\n  renderCalendar() {\n    return new Calendar({\n      el: this.calendar.nativeElement,\n      currentDate: \"2019/08/28\",\n      onDayClick: onDayClick\n    });\n  }\n\n  onDayClick(date) {\n    console.log(date); // choose date\n  }\n}\n```\n\n## 如何贡献\n\n欢迎每个人为这个项目做出贡献。可以从查看我们[未解决的问题](https://github.com/simbawus/calendar/issues),[提交新问题](https://github.com/simbawus/calendar/issues/new?labels=bug) 或[提出新功能](https://github.com/simbawus/calendar/issues/new?labels=enhancement), 入手，参与讨论投票您喜欢或不喜欢的问题。\n\n## 开源证书\n\n[**The MIT License**](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwusb%2Fcalendar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwusb%2Fcalendar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwusb%2Fcalendar/lists"}