{"id":15854317,"url":"https://github.com/afeiship/simple-date-format","last_synced_at":"2025-10-11T06:09:15.715Z","repository":{"id":187108333,"uuid":"676337436","full_name":"afeiship/simple-date-format","owner":"afeiship","description":"A simple date format.","archived":false,"fork":false,"pushed_at":"2023-10-30T01:22:00.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-07T12:31:19.226Z","etag":null,"topics":["date","dateformat","datetime","dayjs","format","sdf"],"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/afeiship.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-09T01:31:43.000Z","updated_at":"2023-08-09T07:31:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"1a0d8f81-830a-46ba-9a3e-89fff22e2c56","html_url":"https://github.com/afeiship/simple-date-format","commit_stats":null,"previous_names":["afeiship/simple-date-format"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fsimple-date-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fsimple-date-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fsimple-date-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fsimple-date-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afeiship","download_url":"https://codeload.github.com/afeiship/simple-date-format/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246696432,"owners_count":20819454,"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":["date","dateformat","datetime","dayjs","format","sdf"],"created_at":"2024-10-05T19:41:31.909Z","updated_at":"2025-10-11T06:09:10.682Z","avatar_url":"https://github.com/afeiship.png","language":"TypeScript","readme":"# simple-date-format\n\u003e A simple date format.\n\n[![version][version-image]][version-url]\n[![license][license-image]][license-url]\n[![size][size-image]][size-url]\n[![download][download-image]][download-url]\n\n## installation\n```shell\nnpm install @jswork/simple-date-format\n```\n\n## usage\n```js\nimport sdf from '@jswork/simple-date-format';\n\n// get current datetime:\nconst res1 = sdf('YYYY-MM-DD HH:mm:ss');\n// 2020-01-01 12:12:12\n\n// use format hooks\nconst res2 = sdf('date');\n// 2020-01-01\n```\n\n## format hooks\n```js\nconst FORMAT_HOOKS = {\n  date: 'YYYY-MM-DD',\n  datetime: 'YYYY-MM-DD HH:mm:ss',\n  time: 'HH:mm:ss',\n  month: 'YYYY-MM',\n  dbdt: 'YYYYMMDD_HHmmss',\n  fullday: 'YYYY/YYYY-MM/YYYY-MM-DD'\n};\n```\n\n## formats\n\n| format | Output           | Description          |\n|--------|------------------|----------------------|\n| YY     | 18               | 两位数的年份         |\n| YYYY   | 2018             | 四位数的年份         |\n| M      | 1-12             | 月份，从 1 开始      |\n| MM     | 01-12            | 月份，两位数         |\n| D      | 1-31             | 月份里的一天         |\n| DD     | 01-31            | 月份里的一天，两位数 |\n\n\n## license\nCode released under [the MIT license](https://github.com/afeiship/simple-date-format/blob/master/LICENSE.txt).\n\n[version-image]: https://img.shields.io/npm/v/@jswork/simple-date-format\n[version-url]: https://npmjs.org/package/@jswork/simple-date-format\n\n[license-image]: https://img.shields.io/npm/l/@jswork/simple-date-format\n[license-url]: https://github.com/afeiship/simple-date-format/blob/master/LICENSE.txt\n\n[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/simple-date-format\n[size-url]: https://github.com/afeiship/simple-date-format/blob/master/dist/simple-date-format.min.js\n\n[download-image]: https://img.shields.io/npm/dm/@jswork/simple-date-format\n[download-url]: https://www.npmjs.com/package/@jswork/simple-date-format\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafeiship%2Fsimple-date-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafeiship%2Fsimple-date-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafeiship%2Fsimple-date-format/lists"}