{"id":29104572,"url":"https://github.com/serayaeryn/fast-date-format","last_synced_at":"2025-06-29T00:06:12.535Z","repository":{"id":32552783,"uuid":"136834792","full_name":"SerayaEryn/fast-date-format","owner":"SerayaEryn","description":"fast date formating","archived":false,"fork":false,"pushed_at":"2025-06-17T07:14:29.000Z","size":101,"stargazers_count":8,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-22T09:44:37.031Z","etag":null,"topics":["dateformat","fast","nodejs"],"latest_commit_sha":null,"homepage":"","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/SerayaEryn.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-10T18:33:44.000Z","updated_at":"2025-06-20T19:46:38.000Z","dependencies_parsed_at":"2024-06-18T21:10:16.811Z","dependency_job_id":"4d027e5d-f57e-4bf0-8ae3-764d9ad42179","html_url":"https://github.com/SerayaEryn/fast-date-format","commit_stats":{"total_commits":92,"total_committers":8,"mean_commits":11.5,"dds":"0.21739130434782605","last_synced_commit":"b725a07bffae507ccf6cc748d02fd4ce57308416"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/SerayaEryn/fast-date-format","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SerayaEryn%2Ffast-date-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SerayaEryn%2Ffast-date-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SerayaEryn%2Ffast-date-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SerayaEryn%2Ffast-date-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SerayaEryn","download_url":"https://codeload.github.com/SerayaEryn/fast-date-format/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SerayaEryn%2Ffast-date-format/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262514198,"owners_count":23322698,"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":["dateformat","fast","nodejs"],"created_at":"2025-06-29T00:06:09.819Z","updated_at":"2025-06-29T00:06:12.525Z","avatar_url":"https://github.com/SerayaEryn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fast-date-format\n\n![Build Status](https://github.com/SerayaEryn/fast-date-format/workflows/ci/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/SerayaEryn/fast-date-format/badge.svg?branch=master)](https://coveralls.io/github/SerayaEryn/fast-date-format?branch=master)\n[![NPM version](https://img.shields.io/npm/v/fast-date-format.svg?style=flat)](https://www.npmjs.com/package/fast-date-format)\n\n`fast-date-format` is significantly faster than other date formatting modules. \n\n## Installation\n```\nnpm install fast-date-format\n```\n## Example\n\n```js\nimport { DateFormatter } from 'fast-date-format';\n\nconst dateFormat = new DateFormatter('YYYYMMDD');\n\ndateFormat.format();\ndateFormat.format(new Date());\n```\n\n## Escaping\n\nTo escape characters in a format, surround the characters with square brackets.\n\n```js\nconst dateFormat = new DateFormatter('[Month: ]MMMM');\n\ndateFormat.format(); // Month: December\n```\n\n## Tokens\n\nSupported formatting tokens:\n\n| Token         | Example\t           | Description           |\n| ------------- | ------------------ |---------------------- |\n| YYYY          | `2018`             | Year                  |\n| YY            | `18`               | 2 Digit Year          |\n| MMMM          | `January..December`| Month name            |\n| MMM           | `Jan..Dec`         | 3 letter month name   |\n| MM            | `01..12`           | Month                 |\n| M             | `1..12`            | Month                 |\n| HH            | `00..23`           | Hours (24 hour time)  |\n| H             | `0..23`            | Hours (24 hour time)  |\n| hh            | `01..12`           | Hours (12 hour time)  |\n| h             | `1..12`            | Hours (12 hour time)  |\n| kk            | `01..24`           | Hours (24 hour time)  |\n| k             | `1..24`            | Hours (24 hour time)  |\n| A             | `am`, `pm`         | Post or ante meridiem |\n| dddd          | `Monday..Sunday`   | Day name              |\n| ddd           | `Mon..Sun`         | 3 letter day name    |\n| DDDD          | `001..365`         | Day of year          |\n| DDD           | `1..365`           | Day of year          |\n| DD            | `01..31`           | Day of month         |\n| D             | `1..31`            | Day of month         |\n| E             | `1..7`             | Day of week          |\n| m             | `0..59`            | Minutes              |\n| mm            | `00..59`           | Minutes              |\n| s             | `0..59`            | Seconds              |\n| ss            | `00..59`           | Seconds              |\n| SSS           | `000..999`         | Milliseconds         |\n| ZZ            | `-02:00`           | Offset from UTC      |\n| Z             | `-0200`            | Offset from UTC      |\n| x             | `1528643900952`    | Unix timestamp in ms |\n\n## API\n\n### DateFormatter(options)\n\nCreates a new date formatter.\n\n### options\n\nEither a date format as a string or an object with the following properties:\n\n#### dateFormat\n\nA date format as a string.\n\n#### cache (optional)\n\nEnables caching to increase formatting speed if set to `true`. Defaults to `false`.\n\n### DateFormatter#format([date])\n\nFormats the `date` according to the `dateFormat`. If no date is passed the current date is used.\n\n### DateFormatter#addLocale(language, data)\n\nAdds translations for the names of months and weekdays. \n\n```js\ndateFormat.addLocale('en', {\n  weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n  months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n})\n```\nThree letter abbreviations of the names are being generated from the months and weekdays.\n\n### DateFormatter#setLocale(language)\n\nChanges the locale of the `DateFormat` instace to `language`. Build-in languages: `en`, `de` \u0026 `it`.\n\n```js\ndateFormat.setLocale('en')\n```\n\n## Benchmark\n\nThe benchmark has been run with Node.js v24.2.0.\n\n```bash\n$ node benchmark/benchmark.js\nmoment x 1,063,970 ops/sec ±0.76% (90 runs sampled)\ndate-format x 1,209,666 ops/sec ±0.29% (96 runs sampled)\ndateformat x 557,058 ops/sec ±0.36% (95 runs sampled)\nfast-date-format x 10,317,337 ops/sec ±0.41% (97 runs sampled)\nfecha x 740,233 ops/sec ±0.82% (52 runs sampled)\nspeed-date x 9,729,244 ops/sec ±0.47% (97 runs sampled)\ndate-fns x 417,645 ops/sec ±0.33% (92 runs sampled)\nFastest is fast-date-format\n```\n\nWith activated `cache` option:\n\n```bash\n$ node benchmark/benchmarkCache.js\nmoment x 1,411,803 ops/sec ±0.51% (99 runs sampled)\ndate-format x 1,686,897 ops/sec ±0.28% (81 runs sampled)\ndateformat x 822,427 ops/sec ±0.90% (96 runs sampled)\nfast-date-format x 14,652,810 ops/sec ±0.40% (95 runs sampled)\nfecha x 972,796 ops/sec ±0.34% (99 runs sampled)\nspeed-date x 13,002,381 ops/sec ±0.43% (95 runs sampled)\ndate-fns x 587,636 ops/sec ±0.31% (100 runs sampled)\nFastest is fast-date-format\n```\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserayaeryn%2Ffast-date-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserayaeryn%2Ffast-date-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserayaeryn%2Ffast-date-format/lists"}