{"id":23181631,"url":"https://github.com/likhithkp/date-formatter-lib","last_synced_at":"2025-06-19T19:35:07.165Z","repository":{"id":267610836,"uuid":"901788017","full_name":"likhithkp/date-formatter-lib","owner":"likhithkp","description":"A simple utility to format dates in various formats using dayjs. This package allows developers to easily format dates into commonly used formats.","archived":false,"fork":false,"pushed_at":"2024-12-11T10:51:51.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T00:08:11.997Z","etag":null,"topics":["date-format","date-formatting"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/date-formatter-lib","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/likhithkp.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-11T10:11:38.000Z","updated_at":"2024-12-11T10:51:56.000Z","dependencies_parsed_at":"2024-12-11T11:31:44.928Z","dependency_job_id":"86ffa160-4d15-4206-a384-536cfcf1a6d6","html_url":"https://github.com/likhithkp/date-formatter-lib","commit_stats":null,"previous_names":["likhithkp/get-date"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likhithkp%2Fdate-formatter-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likhithkp%2Fdate-formatter-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likhithkp%2Fdate-formatter-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likhithkp%2Fdate-formatter-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/likhithkp","download_url":"https://codeload.github.com/likhithkp/date-formatter-lib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280259,"owners_count":20912967,"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-format","date-formatting"],"created_at":"2024-12-18T08:16:58.748Z","updated_at":"2025-04-05T03:16:02.716Z","avatar_url":"https://github.com/likhithkp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# date-formatter-lib\n\nA simple utility to format dates in various formats using `dayjs`. This package allows developers to easily format dates into commonly used formats.\n\n## Installation\n\nYou can install the package via npm:\n\n```bash\nnpm install date-formatter-lib\n```\n\n## Usage\nAfter installing the package, you can easily import and use it in your project.\n\n```bash\nconst formatDate = require('date-formatter-lib');\n\n// Example usage:\nconst formattedDate = formatDate(new Date(), 'mdyts');\nconsole.log(formattedDate); // Example output: Sep 20, 2018 10:45:33 PM\n```\n\n## Available Format Options\nYou can pass a date and a format string to the formatDate function. Here are the available formats:\n\n```bash\nmdyts: Sep 20, 2018 10:45:33 PM\nmdyt: Sep 20, 2018 10:45 PM\ndmy: 20 Sep 2018\nd-m-y: 20-Sep-2018\ndmdyt: Thu, Sep 20, 2018 10:45 PM\nDM3Yd: 21-Sep-18,Fri\nDM2Yhms: 21-09-2018(10.45.53 PM)\nDM3Yhms: 21-Sep-2018 10.45.53 PM\nDM3Y4d2: 21-Sep-2018,Friday\nDM3Ydt: 21-Sep-18,Fri 10.45 PM\nDM3YdtDN: 21-Sep-18,Fri 10.45 PM (Day or Night)\nDDMMMYY-hh.mm.ssA: 21Sep18-10.45.53PM\nyyyy-MM-dd: 2021-11-17\nt-d: 21-Sep-2018 10.45.53 PM\ndd-mm-yy: 21-09-18\nhhmmA: 21-Sep-18,Fri 10.45 PM\n```\n\n## Example Code\n\n```bash\nconst formatDate = require('date-formatter-lib');\n\nconst date = new Date();\nconsole.log(formatDate(date, 'mdyts'));  // Sep 20, 2018 10:45:33 PM\nconsole.log(formatDate(date, 'dmy'));    // 20 Sep 2018\nconsole.log(formatDate(date, 'yyyy-MM-dd')); // 2021-11-17\n```\n\n## Error Handling\nIf you pass an invalid date to the function, it will throw an error. Make sure to catch it or check the validity of the date before using it:\n\n```bash\ntry {\n    console.log(formatDate(\"invalid date\", 'mdyts'));\n} catch (error) {\n    console.error(\"Error:\", error.message);  // Invalid Date Format\n}\n```\n\n## Powered by dayjs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flikhithkp%2Fdate-formatter-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flikhithkp%2Fdate-formatter-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flikhithkp%2Fdate-formatter-lib/lists"}