{"id":15101845,"url":"https://github.com/avaray/datr","last_synced_at":"2026-01-18T17:32:35.512Z","repository":{"id":57211568,"uuid":"161514707","full_name":"Avaray/datr","owner":"Avaray","description":"This package generates a date in a programmer-friendly format","archived":false,"fork":false,"pushed_at":"2024-06-17T11:00:58.000Z","size":34,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T18:56:45.830Z","etag":null,"topics":["bun","bunjs","date","development","devops","format","formatting","node","node-js","nodejs","npm","time","timestamp","timestamps","uncommon"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/datr","language":"JavaScript","has_issues":false,"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/Avaray.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-12-12T16:23:31.000Z","updated_at":"2024-07-26T07:50:28.000Z","dependencies_parsed_at":"2024-02-23T00:22:22.628Z","dependency_job_id":"b77c7ea6-c7d8-48bb-ac82-6cca7a0bbc01","html_url":"https://github.com/Avaray/datr","commit_stats":{"total_commits":55,"total_committers":2,"mean_commits":27.5,"dds":0.2545454545454545,"last_synced_commit":"26811c2f4a6f833a3ebfcbcd07a1fa1963830662"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Avaray%2Fdatr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Avaray%2Fdatr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Avaray%2Fdatr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Avaray%2Fdatr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Avaray","download_url":"https://codeload.github.com/Avaray/datr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332511,"owners_count":20921852,"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":["bun","bunjs","date","development","devops","format","formatting","node","node-js","nodejs","npm","time","timestamp","timestamps","uncommon"],"created_at":"2024-09-25T18:41:24.745Z","updated_at":"2026-01-18T17:32:35.484Z","avatar_url":"https://github.com/Avaray.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🕘 DATR\n\nThis package will help you generate a date in a programmer-friendly format.  \nIt might be useful for console logging, generating IDs, naming files, etc.\n\n## The Idea\n\nLet's treat the **Date** as a **number**. It's all about increasing that **number**.  \n[Unix time](https://en.wikipedia.org/wiki/Unix_time) does that, but it's not human-readable.  \nThe solution is to start with [YMD](https://en.wikipedia.org/wiki/Date_format_by_country#/media/File:Date_format_by_country_3.svg), add hours to it, and include milliseconds as the smallest unit.  \nThe end result is the format **YYYYMMDDHHMMSSms**.  \nMany people use such a format. However, it has never been standardized.\n\n## DATR takes two arguments\n\n### First, optional argument is `precision`\n\nThe argument sets the precision we want to see in output.\n\n`0` - Year, Month, Day (default)  \n`1` - Year, Month, Day, Hour, Minute, Second  \n`2` - Year, Month, Day, Hour, Minute, Second, Millisecond\n\n### Second, optional argument is `separator`\n\nYou can pass a string separator to separate **blocks** and make the output more readable.  \nIn examples below you can see dots and hyphens.\n\n## [Module](https://nodejs.org/api/esm.html#introduction) Installation\n\nBy using [NPM](https://docs.npmjs.com/cli-documentation/install)\n\n```bash\nnpm i datr\n```\n\nBy using [PNPM](https://pnpm.io/cli/add)\n\n```bash\npnpm add datr\n```\n\nBy using [BUN](https://bun.sh/docs/cli/add)\n\n```bash\nbun i datr\n```\n\n## [Module](https://nodejs.org/api/esm.html#introduction) Usage\n\n```js\nimport datr from 'datr';\n\nconsole.log(typeof datr());\n// string\n\nconsole.log(datr());\n// 20221230\n\nconsole.log(datr(1));\n// 20221230183500\n\nconsole.log(datr(2));\n// 20221230183500001\n\nconsole.log(datr(2, '.'));\n// 20221230.183500.001\n\nconsole.log(datr(2, '-'));\n// 20221230-183500-001\n```\n\n## [CLI](https://en.wikipedia.org/wiki/Command-line_interface) installation\n\nBy using [NPM](https://docs.npmjs.com/cli/v10/commands/npm-install#global)\n\n```bash\nnpm i -g datr\n```\n\nBy using [PNPM](https://pnpm.io/cli/add#--global--g)\n\n```bash\npnpm add -g datr\n```\n\nBy using [BUN](https://bun.sh/docs/cli/add#global)\n\n```bash\nbun i -g datr\n```\n\n## [CLI](https://en.wikipedia.org/wiki/Command-line_interface) usage\n\n```bash\ndatr\n# 20221230\n\ndatr 1\n# 20221230183500\n\ndatr 2\n# 20221230183500001\n\ndatr 2 .\n# 20221230.183500.001\n\ndatr 2 -\n# 20221230-183500-001\n```\n\n## [CLI](https://en.wikipedia.org/wiki/Command-line_interface) usage without installation\n\nBy using [NPM](https://docs.npmjs.com/cli/v10/commands/npx)\n\n```bash\nnpx datr\n```\n\nBy using [PNPM](https://pnpm.io/cli/dlx)\n\n```bash\npnpm dlx datr\n```\n\nBy using [BUN](https://bun.sh/docs/cli/bunx)\n\n```bash\nbunx datr\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favaray%2Fdatr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favaray%2Fdatr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favaray%2Fdatr/lists"}