{"id":13448647,"url":"https://github.com/Fi2zz/TypePicker","last_synced_at":"2025-03-22T09:31:31.397Z","repository":{"id":57383651,"uuid":"110407052","full_name":"Fi2zz/TypePicker","owner":"Fi2zz","description":"A date picker use in web and react-native","archived":true,"fork":false,"pushed_at":"2020-10-14T08:38:25.000Z","size":2011,"stargazers_count":14,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T15:33:51.942Z","etag":null,"topics":["datepicker","react-datepicker","typescript","vanilla-js","vue-datepicker"],"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/Fi2zz.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":"2017-11-12T05:17:21.000Z","updated_at":"2023-01-28T01:30:51.000Z","dependencies_parsed_at":"2022-09-14T00:21:21.421Z","dependency_job_id":null,"html_url":"https://github.com/Fi2zz/TypePicker","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fi2zz%2FTypePicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fi2zz%2FTypePicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fi2zz%2FTypePicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fi2zz%2FTypePicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fi2zz","download_url":"https://codeload.github.com/Fi2zz/TypePicker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244937751,"owners_count":20535124,"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":["datepicker","react-datepicker","typescript","vanilla-js","vue-datepicker"],"created_at":"2024-07-31T05:01:51.584Z","updated_at":"2025-03-22T09:31:30.966Z","avatar_url":"https://github.com/Fi2zz.png","language":"TypeScript","readme":"# TypePicker\n\nA date picker use in web and react-native\n\n## INSTALL\n\n```bash\n\n\tnpm install typepicker\n\tor\n\tyarn add typepicker\n\n```\n\n## OPTIONS\n\n| OPTION    | REQUIRED | TYPE   | DESC                 | Default |\n| --------- | -------- | ------ | -------------------- | ------- |\n| size      | NO       | number | Size of data created | 1       |\n| selection | NO       | number | Size of data picked  | 1       |\n\n## API\n\n```typescript\n\n\n\tapply.select(date:Date)=\u003evoid\n\n\tapply.date(date:Date)=\u003evoid\n\n\tapply.dates(dates:Date[])=\u003evoid\n\n\tapply.update()=\u003evoid;\n\n\tapply.disableDate((date:Date)=\u003eboolean)\n\n\tlisten(({type,types,payload})=\u003evoid)\n\n```\n\n### EXAMPLE\n\n[Full Example](./example)\n\n```typescript\n\n\t//if you are using typescript\n\timport TypePicker from \"typepicker\";\n\n\tconst config = {\n\t\tsize:1,\n\t\tselection:1\n\t}\n\n\tinterface TypePickerDate {\n\t  date: Date;\n\t  invalid: boolean;\n\t  disabled: boolean;\n\t  status?: {\n\t    isActive?: boolean;\n\t    isStart?: boolean;\n\t    isEnd?: Boolean;\n\t    inRange?: Boolean;\n\t  };\n\t}\n\n\n\tconst typepicker= new TypePicker(config);\n\n\tconst onSelectDate =(date:Date[])=\u003e{\n\n\t\t// to disaplay selected values\n\t}\n\tconst onDataUpdate =(data:[])=\u003e{\n\n\t\t\tconst renderData =data.map(item=\u003e{\n\t\t\t\t\t\treturn  {\n\t\t\t\t\t\t\tyear: \u003cnumber\u003eitem.year\n\t\t\t\t\t\t\tmonth: \u003cnumber\u003e item.month,\n\t\t\t\t\t\t\tdates: \u003cTypePickerDate\u003eitem.dates\t\t\t\t\t\t}\n\t\t\t})\n\t\t//here goes how your datepicker ui render\n\t\t//example\n\t\t//document.getElementById('picker') .innerHTML=template(renderData)\n\n\n\n\t}\n\n\t//setup listeners of select date and data update;\n\ttypepicker.listen(({type,payload})=\u003e[\n\t\t\t\tif(type==='select'){onSelectDate(payload)}\n\t\t\t\tif(type==='update'){onDataUpdate(payload)}\n\t})\n\n\n\t// jump to some date\n\t// typically use in switching ui display\n\n\ttypePicker.apply.date(new Date(2019,7,1))\n\n\t//set initial dates , its length should euqal to `config.selection`,\n\t//do not care about the order, we sort them inside picker\n\ttypepicker.apply.dates([someDateObject1,...res])\n\n\t//set disabled date\n\ttypepicker.apply.disableDate(date=\u003e{\n\t\t\treturn date.getDate() ===31 || date.getDay()===4 //...more conditions\n\t})\n\n\t//call TypePicker update method to trigger rerender\n\ttypepicker.apply.update()\n\n\t//select some date from picker data\n\t//it will trigger `typepicker.listen`\n\ttypepicker.apply.select(someDateObject)\n\n\n\n\n\n\n\n\n```\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFi2zz%2FTypePicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFi2zz%2FTypePicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFi2zz%2FTypePicker/lists"}