{"id":18779911,"url":"https://github.com/lhajman/f-duration","last_synced_at":"2025-12-18T14:30:26.043Z","repository":{"id":57686244,"uuid":"474776583","full_name":"tal7aouy/f-duration","owner":"tal7aouy","description":"⚡️  Convert milliseconds to a standard duration string. ","archived":false,"fork":false,"pushed_at":"2022-03-27T22:39:54.000Z","size":61,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T12:48:12.937Z","etag":null,"topics":["convert","convert-timestamps","milliseconds","time"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tal7aouy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-27T22:36:47.000Z","updated_at":"2022-03-27T22:39:28.000Z","dependencies_parsed_at":"2022-09-18T23:13:51.051Z","dependency_job_id":null,"html_url":"https://github.com/tal7aouy/f-duration","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/tal7aouy%2Ff-duration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tal7aouy%2Ff-duration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tal7aouy%2Ff-duration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tal7aouy%2Ff-duration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tal7aouy","download_url":"https://codeload.github.com/tal7aouy/f-duration/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239694709,"owners_count":19681914,"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":["convert","convert-timestamps","milliseconds","time"],"created_at":"2024-11-07T20:23:53.133Z","updated_at":"2025-12-18T14:30:20.593Z","avatar_url":"https://github.com/tal7aouy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Convert a number in milliseconds to a standard duration string.\n\n| Input :disappointed: | Value :joy: |\n| -------------------- | ----------- |\n| `999`                | `'0:00'`    |\n| `1000`               | `'0:01'`    |\n| `1000 * 60`          | `'1:00'`    |\n| `1000 * 60 * 60`     | `'1:00:00'` |\n\n## Install\n\nGet it on [npm](https://www.npmjs.com/package/f-duration)\n\n```bash\nnpm install f-durationta\n```\n\nGet it on [yarn](https://yarnpkg.com/package/f-duration)\n\n```bash\nyarn add  f-duration\n```\n\n## Usage\n\n```js\nimport format from \"f-duration\"\n\nformat(ms: number, options?: IOption)\n\n// anything under a second is rounded down to zero\nformat(999) // '0:00'\n\n// 1000 milliseconds is a second\nformat(1000) // '0:01'\n\n// 1999 rounds down to 0:01\nformat(1000 * 2 - 1) // '0:01'\n\n// 60 seconds is a minute\nformat(1000 * 60) // '1:00'\n\n// 59 seconds looks like this\nformat(1000 * 60 - 1) // '0:59'\n\n// 60 minutes is an hour\nformat(1000 * 60 * 60) // '1:00:00'\n\n// 59 minutes and 59 seconds looks like this\nformat(1000 * 60 * 60 - 1) // '59:59'\n\n// 24 hours is a day\nformat(1000 * 60 * 60 * 24) // '1:00:00:00'\n\n// 23 hours, 59 minutes, and 59 seconds looks like this\nformat(1000 * 60 * 60 * 24 - 1) // '23:59:59'\n\n// 365 days looks like this (not bothering with years)\nformat(1000 * 60 * 60 * 24 * 365) // '365:00:00:00'\n\n// anything under a second is rounded down to zero\nformat(-999) // '0:00'\n\n// 1000 milliseconds is a second\nformat(-1000) // '-0:01'\n\n// 365 days looks like this (not bothering with years)\nformat(-1000 * 60 * 60 * 24 * 365) // '-365:00:00:00'\n\n// with `leading` option, formatting looks like this\nformat(1000 * 60, { leading: true }) // '01:00'\nformat(1000 * 60 - 1, { leading: true }) // '00:59'\nformat(1000 * 60 * 60, { leading: true }) // '01:00:00'\n```\n\n## Contributing\n\nContributions welcome! Please read the [contributing guidelines](CONTRIBUTING.md) first.\n\n## Default Options\n\n| Name      | Type      | Default | Description                                                             |\n| --------- | --------- | ------- | ----------------------------------------------------------------------- |\n| `leading` | `boolean` | `false` | leading zero eg:(format(1000,{leading:true})) (00:01) instead of (0:01) |\n\n---\n\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flhajman%2Ff-duration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flhajman%2Ff-duration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flhajman%2Ff-duration/lists"}