{"id":16057971,"url":"https://github.com/hedyhli/deno-datefmt","last_synced_at":"2025-04-05T08:15:05.181Z","repository":{"id":240062300,"uuid":"801569085","full_name":"hedyhli/deno-datefmt","owner":"hedyhli","description":"Unambiguous Golang-style date formatting library for Deno.","archived":false,"fork":false,"pushed_at":"2024-12-20T08:33:42.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T15:50:43.322Z","etag":null,"topics":["deno","library","typescript"],"latest_commit_sha":null,"homepage":"https://deno.land/x/datefmt","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/hedyhli.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":"2024-05-16T13:38:51.000Z","updated_at":"2024-12-20T08:33:46.000Z","dependencies_parsed_at":"2024-12-18T13:54:36.948Z","dependency_job_id":null,"html_url":"https://github.com/hedyhli/deno-datefmt","commit_stats":null,"previous_names":["hedyhli/deno-datefmt"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedyhli%2Fdeno-datefmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedyhli%2Fdeno-datefmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedyhli%2Fdeno-datefmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedyhli%2Fdeno-datefmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hedyhli","download_url":"https://codeload.github.com/hedyhli/deno-datefmt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305947,"owners_count":20917208,"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":["deno","library","typescript"],"created_at":"2024-10-09T03:05:41.324Z","updated_at":"2025-04-05T08:15:05.164Z","avatar_url":"https://github.com/hedyhli.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# datefmt\n\n[![Checks](https://github.com/hedyhli/deno-datefmt/actions/workflows/deno.yml/badge.svg)](https://github.com/hedyhli/deno-datefmt/actions/workflows/deno.yml)\n![deno-coverage](https://img.shields.io/badge/Coverage-100%25-2ebb4e)\n\n```js\nimport datefmt from \"https://deno.land/x/datefmt/mod.ts\"\n\ndatefmt(new Date(1999, 5, 4), \"[JAN]. [2nd], [2006]\")\n=\u003e \"MAR. 4th, 1999\"\n```\n\n- Similar to Golang's date(time) formats, but delimiters around format\n  specifiers are required. This makes formatting less ambiguous.\n- 'nth' day formats are supported\n- All forms of capitalization and zero-padding are both supported.\n\nThe default delimiters are `[]`.\n\nDelimiters can optionally be the same character.\n\n```js\n// Use single quote for both start and end delim\ndatefmt(date, \"'2006' 'January'\", true, \"'\")\n\n// Use \u003c for start, and | for the end delim.\ndatefmt(date, \"\u003c2006| \u003cJanuary|\", true, \"\u003c|\")\n```\n\n## API\n\nDefault arguments\n\n```js\ndatefmt(\n  // Required arguments\n  date,  // Date object\n\n  // Optional arguments' default values:\n  \"[2006]-[01]-[02]\", // Format\n  true,  // whether to use UTC\n  \"[]\"   // Delimiters -- either one or two characters.\n)\n```\n\nOnly string within the delimiters are treated as format specifiers. Anything\nelse is copied as-is.\n\nEdge cases, where `delim = \"[]\"`:\n- `A[]B` =\u003e `\"A[]B\"`\n- `A[[]B` =\u003e `\"A[B\"`\n- `A[]]B` =\u003e `\"A]B\"`\n\nIf delimiters are the same character, where `delim = \".\"`:\n- `A.B` =\u003e `A.B`\n- `A..B` =\u003e `A..B`\n- `A...B` =\u003e `A.B`\n\n## Supported format specifiers\n\nThe standard date used is `Monday, January 2nd 03:04:05 PM 2006`\n\nTip for memorising: `01/02 03:04:05 2006 (PM) (Monday)`\n\nUse any of the following format specifiers from within delimiters (by default,\n`[]`), and they will be replaced with the corresponding value from the Date\nobject.\n\nDate\n- 2006, 06, 6\n- 01, 1\n- Jan, jan, JAN, January, january, JANUARY\n- 02, 2\n- 2nd, 2ND\n\nDay\n- Mon, mon, MON, Monday, monday, MONDAY\n\nTime\n- PM, Pm, pm\n- 3, 03\n- 15 (24-hour time), 015\n- 4, 04\n- 5, 05\n\nNote, `\"015\"` is a special format for both 24-houur time and zero-padded. I.e.,\nif the time is 9 AM, \"15\" and \"3\" both gives \"9\", whereas \"015\" and \"03\" both\ngives \"09\".\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhedyhli%2Fdeno-datefmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhedyhli%2Fdeno-datefmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhedyhli%2Fdeno-datefmt/lists"}