{"id":13516590,"url":"https://github.com/porsager/datie","last_synced_at":"2025-10-05T09:57:17.452Z","repository":{"id":42572040,"uuid":"263574192","full_name":"porsager/datie","owner":"porsager","description":"Small template string based date formatter for the browser and Node.js.","archived":false,"fork":false,"pushed_at":"2025-09-02T21:27:05.000Z","size":14,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-02T23:20:28.100Z","etag":null,"topics":["date","formatter"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/porsager.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-05-13T08:44:17.000Z","updated_at":"2025-09-02T21:27:08.000Z","dependencies_parsed_at":"2024-01-13T19:26:09.400Z","dependency_job_id":"49050030-6fc6-4a9c-83f1-853964ef057b","html_url":"https://github.com/porsager/datie","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"1345047d55caff0bef538a9100010abc38080121"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/porsager/datie","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porsager%2Fdatie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porsager%2Fdatie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porsager%2Fdatie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porsager%2Fdatie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/porsager","download_url":"https://codeload.github.com/porsager/datie/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porsager%2Fdatie/sbom","scorecard":{"id":741355,"data":{"date":"2025-08-11","repo":{"name":"github.com/porsager/datie","commit":"9059d59566d565e26f6b95da3254cb584b774c21"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 2/21 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":2,"reason":"2 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Do What The F*ck You Want To Public License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T17:33:19.662Z","repository_id":42572040,"created_at":"2025-08-22T17:33:19.662Z","updated_at":"2025-08-22T17:33:19.662Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278437950,"owners_count":25986760,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","formatter"],"created_at":"2024-08-01T05:01:23.884Z","updated_at":"2025-10-05T09:57:17.447Z","avatar_url":"https://github.com/porsager.png","language":"JavaScript","readme":"# 🗓 Datie\n\nSmall template string based date formatter for the browser and Node.js. It supports custom specifiers and relative time calculations without external libraries. Datie is lightweight (~1KB minified) and caches formatters for performance.\n\n### LDML Compliance\n\nFollows Unicode LDML date patterns (https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table) with additions:\n- `o`: Ordinal suffix (e.g., `1st`, `2nd`) for numbers like day or month.\n- `R`: Relative time (e.g., `1 minute ago`, `in 2 days`).\n\n# Usage\n\nDatie uses tagged template literals to define formats, returning a reusable function that accepts a Date object or compatible string. Formatters are cached by string.\n\n```js\nimport d from 'datie'\n\nconst string = '2020-05-13T08:34:30.911Z'\nconst date = new Date(string)\n\nd`d/M-y hh:mm`(string) // '13/5-2020 08:34'\nd`d/M-y hh:mm`(date)    // '13/5-2020 08:34'\n```\n\n## Supported Specifiers\n\nComprehensive list of format specifiers, with descriptions and examples (using July 19, 2025, Saturday, 12:34:56):\n\n- **Year**:\n  - `y` / `yyyy`: Full year → '2025'\n  - `yy`: Two-digit year → '25'\n\n- **Month**:\n  - `M`: Month number (1-12) → '7'\n  - `MM`: Padded month (01-12) → '07'\n  - `MMM`: Abbreviated month → 'Jul'\n  - `MMMM`: Full month → 'July'\n  - `MMMMM`: Narrow month (first letter) → 'J'\n\n- **Day**:\n  - `d`: Day of month (1-31) → '19'\n  - `dd`: Padded day (01-31) → '19'\n\n- **Weekday**:\n  - `e`: Weekday number (0=Sun-6=Sat) → '6'\n  - `ee`: Padded weekday number → '06'\n  - `E` / `EE` / `EEE`: Abbreviated weekday → 'Sat'\n  - `EEEE`: Full weekday → 'Saturday'\n  - `EEEEE`: Narrow weekday → 'Sa'\n  - `EEEEEE`: Shortest weekday → 'S'\n\n- **Hour** (24-hour; `h`/`hh` aliases `H`/`HH`; no AM/PM):\n  - `H` / `h`: Hour (0-23) → '12'\n  - `HH` / `hh`: Padded hour → '12'\n\n- **Minute**:\n  - `m`: Minute (0-59) → '34'\n  - `mm`: Padded minute → '34'\n\n- **Second**:\n  - `s`: Second (0-59) → '56'\n  - `ss`: Padded second → '56'\n\n- **Week** (ISO week, Thursday-based):\n  - `w`: Week of year (1-53) → '29'\n  - `ww`: Padded week → '29'\n\n- **Quarter**:\n  - `Q`: Quarter (1-4) → '3'\n  - `QQ`: Padded quarter → '03'\n  - `QQQ`: Prefixed quarter → 'Q3'\n  - `QQQQ`: Full with ordinal → '3rd quarter'\n\n- **Ordinal Suffix**:\n  - `o`: Suffix for prior number (e.g., `do` → '19th', `Qo` → '3rd')\n\n## Relative Time Formatting\n\nUse `R` for relative time vs. current time (`new Date()`). Handles past (`ago`) and future (`in`), with pluralization and `\u003c5s` as `a few seconds ago`/`in a few seconds`. Threshold for `now` is under 5 seconds.\n\nThere is an optional 2nd parameter accepted if you want to provide a different reference point instead of Date.now().\n\nExamples (assuming current time is July 22, 2025, 12:00:00):\n\n```js\nconst reference = new Date('2025-07-22T11:55:00')\nconst pastDate = reference.getTime() - 1000 * 60 * 5  // 5 minutes ago\nconst futureDate = reference.getTime() + 1000 * 60 * 10 // 10 minutes future\n\nd`R`(pastDate, reference)    // '5 minutes ago'\nd`R`(futureDate, reference)  // 'in 10 minutes'\nd`R`(new Date())             // 'now' (or 'a few seconds ago' if slight offset)\n```\n\n## Relative Fallbacks\n\nCombine relative time with a fallback format using thresholds. If the date is within the spec (past or future), show relative; else, use fallback.\n\n- **Syntax**:\n  - Past: `R\u003cspec\u003e \u003cfallback\u003e` (e.g., `R1D yyyy-MM-dd`) – Relative if past and within spec.\n  - Future: `\u003cfallback\u003e R\u003cspec\u003e` (e.g., `yyyy-MM-dd R1Y`) – Relative if future and within spec.\n- **Spec**: `\u003cnumber\u003e[unit]`; units: `m` (minutes, default), `H` (hours), `D` (days), `M` (months), `Y` (years). No spec = always relative (threshold Infinity).\n\nExamples (current: July 22, 2025, 12:00:00):\n\n```js\n// Past fallback\nconst recentPast = new Date('2025-07-22T11:00:00')  // 1 hour ago\nconst oldPast = new Date('2025-07-20T12:00:00')     // \u003e1 day ago\n\nd`R1D yyyy-MM-dd HH:mm`(recentPast)  // '1 hour ago'\nd`R1D yyyy-MM-dd HH:mm`(oldPast)     // '2025-07-20 12:00'\n\n// Future fallback\nconst nearFuture = new Date('2025-07-22T15:00:00')  // 3 hours future\nconst farFuture = new Date('2025-08-22T12:00:00')   // \u003e15 days future\n\nd`yyyy-MM-dd HH:mm R3H`(nearFuture)  // 'in 3 hours'\nd`yyyy-MM-dd HH:mm R3H`(farFuture)   // '2025-08-22 12:00'\n\n// Other specs\nd`yyyy-MM-dd R15D`(farFuture)        // '2025-08-22' (31 days \u003e15D)\nd`yyyy-MM-dd R6M`(new Date('2025-12-22'))  // 'in 5 months'\nd`yyyy-MM-dd R1Y`(new Date('2026-07-22'))  // 'in 1 year'\nd`yyyy-MM-dd R1Y`(new Date('2027-01-01'))  // '2027-01-01' (\u003e1Y)\n```\n\n## Localization\n\nOverride names for days, months, seasons (relative time fixed in English):\n\n```js\nd.names = {\n  days: ['Domingo', 'Lunes', /* Spanish days */],\n  months: ['Enero', 'Febrero', /* Spanish months */],\n  seasons: ['Primavera', 'Verano', 'Otoño', 'Invierno'],\n  ordinals: ['o', 'o', 'o', 'o']  // Custom ordinals (e.g., Spanish)\n}\n```\n\n\u003e [!NOTE]\n\u003e Localization doesn't alter LTR output or handle all global formats. Relative strings remain English.","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fporsager%2Fdatie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fporsager%2Fdatie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fporsager%2Fdatie/lists"}