{"id":19760142,"url":"https://github.com/videsk/humanize-date","last_synced_at":"2025-07-03T14:34:40.950Z","repository":{"id":117346633,"uuid":"349592027","full_name":"videsk/humanize-date","owner":"videsk","description":"Humanize dates making them readable in user locale language with ultra-lightweight library","archived":false,"fork":false,"pushed_at":"2022-01-11T03:46:52.000Z","size":124,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-10T23:18:21.824Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/videsk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-03-20T00:48:06.000Z","updated_at":"2022-01-11T03:46:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"97026e11-314b-41ac-9334-a962d426af4e","html_url":"https://github.com/videsk/humanize-date","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videsk%2Fhumanize-date","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videsk%2Fhumanize-date/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videsk%2Fhumanize-date/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videsk%2Fhumanize-date/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/videsk","download_url":"https://codeload.github.com/videsk/humanize-date/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241090532,"owners_count":19907972,"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":[],"created_at":"2024-11-12T03:35:42.983Z","updated_at":"2025-02-28T02:45:26.062Z","avatar_url":"https://github.com/videsk.png","language":"JavaScript","readme":"# Humanize Date\n\nThis library was designed to handle dates and returns readable formats for humans.\n\nHumanize Date not have any dependency, because use native ES6 methods to parse and convert dates to string for be easy readable.\n\nBy default, is adapted to locate the language format of user, so never need worry about use i18n or languages tree shaking. Humanize Date use `navigator.language` as parameter of native method as `toLocaleDateString` and `Intl.RelativeTimeFormat`.\n\nSo, what do you need? Two dates :)\n\n```markdown\nNOTICE: You'll need add polyfill in Safari with previous of the version 14.\n\nSUGGESTION: Add Int from https://polyfill.io/\n```\n\n## How to use\n\n### Install\n\n```shell\nnpm i @videsk/humanize-date\n```\n\nIt's simple:\n\n```js\nnew HumanizeDate()...\n```\n\n### Humanize date to locale\n\nThis returns the date you pass as parameter, will be readable for the user in their local language (browser).\n\n```js\nnew HumanizeDate().toLocale(date1);\n// Output\nMarch 01, 2021\n```\n\n### Humanize relative time to locale\n\nThis returns the relative time in readable units you set as parameter as the result of difference of dates .\n\n```js\nnew HumanizeDate().dates(date1, date2).ago('days');\n// Ouput\n3 days ago\nnew HumanizeDate().dates(date1, date2).within('days');\n// Output\nin 3 days\n```\n\nAlso, you will be able to modify the default `options` passing the second parameter. The available options can you [check here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat).\n\n### Get dates difference in units\n\nAlso, you can get easily the difference between two dates based on the unit.\n\n```js\nnew HumanizeDate().dates(date1, date2).minutes();\n```\n\n## Units\n\nThe available units are: `seconds`, `minutes`, `hours`, `days`, `weeks`, `quarters` and `years`. So you can use it with relative time methods and to get the difference.\n\n# License\n\nLGPL-2.1 developed by Videsk.\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvidesk%2Fhumanize-date","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvidesk%2Fhumanize-date","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvidesk%2Fhumanize-date/lists"}