{"id":16410229,"url":"https://github.com/danasilver/tiny-human-time","last_synced_at":"2025-03-21T03:31:24.523Z","repository":{"id":65419335,"uuid":"53186456","full_name":"danasilver/tiny-human-time","owner":"danasilver","description":"A tiny module for human readable timespans.","archived":false,"fork":false,"pushed_at":"2016-08-23T05:13:16.000Z","size":8,"stargazers_count":10,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-12T06:23:37.651Z","etag":null,"topics":["date-formatting","time-formatting"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danasilver.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-05T06:00:10.000Z","updated_at":"2022-08-19T11:49:12.000Z","dependencies_parsed_at":"2023-01-22T18:15:27.831Z","dependency_job_id":null,"html_url":"https://github.com/danasilver/tiny-human-time","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danasilver%2Ftiny-human-time","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danasilver%2Ftiny-human-time/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danasilver%2Ftiny-human-time/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danasilver%2Ftiny-human-time/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danasilver","download_url":"https://codeload.github.com/danasilver/tiny-human-time/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221811376,"owners_count":16884305,"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":["date-formatting","time-formatting"],"created_at":"2024-10-11T06:23:34.641Z","updated_at":"2024-10-28T09:14:16.787Z","avatar_url":"https://github.com/danasilver.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch3 align=\"center\"\u003e\n  \u003cimg src=\"http://i.giphy.com/DluPT7dZ0uXg4.gif\"\u003e\n\u003c/h3\u003e\n\n\u003ch3 align=\"center\"\u003eTiny Human Time\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n  A tiny module for human readable timespans.\n\u003c/p\u003e\n\n[![Build Status](https://travis-ci.org/danasilver/tiny-human-time.svg?branch=master)](https://travis-ci.org/danasilver/tiny-human-time)\n\n## API\n\n### `humanize(t1, t2 [, units])`\n\nWhat you get when you `require('tiny-human-time')`.\n\n`t1` and `t2` are instances of `Date` or integers whose value relative to one\nanother is given in milliseconds. Their order doesn't matter.\n\nIf `t2` is not given, `t1` alone will be used as the timespan relative to 0.\n\nEither argument can be an array of the form `[seconds, nanoseconds]`, like\nthat produced by\n[process.hrtime()](https://nodejs.org/api/process.html#process_process_hrtime).\n\nAn optional last argument, `units` has possible values `short` and `long`,\ndefaulting to `long`. `units` can be given as the last argument even if\n`t2` is not given.\n\nReturns the converted value and the greatest matching unit\nwithout going over. For example, `23 hours` will be followed by `1 day`.\n\n### `humanize.short(t1, t2)`\n\nA convenience method to use `short` units. The possible arguments for `t1` and\n`t2` are the same as `humanize`.\n\n## Supports:\n\n - nanoseconds\n - microseconds\n - milliseconds\n - seconds\n - minutes\n - hours\n - days\n - weeks\n - years\n\n## Usage\n\n```js\nconst humanize = require('tiny-human-time');\n\nconst now = new Date(2016, 3, 5);\nconst later = new Date(2016, 3, 6);\n\nhumanize(now, later);\n// =\u003e 1 day\n```\n\n```js\nconst humanize = require('tiny-human-time');\n\nconst start = process.hrtime()\n// and then a miracle occurs\nconst elapsed = process.hrtime(start)\n\nhumanize(elapsed)\n// =\u003e 23 microseconds\n```\n\n```js\nconst humanize = require('tiny-human-time').short;\n\nhumanize(1)\n// =\u003e 1ms\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanasilver%2Ftiny-human-time","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanasilver%2Ftiny-human-time","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanasilver%2Ftiny-human-time/lists"}