{"id":16125528,"url":"https://github.com/semibran/css-duration","last_synced_at":"2026-05-19T02:01:59.620Z","repository":{"id":57210919,"uuid":"74104793","full_name":"semibran/css-duration","owner":"semibran","description":"Converts CSS-style durations to milliseconds.","archived":false,"fork":false,"pushed_at":"2017-02-05T08:07:36.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T00:35:05.002Z","etag":null,"topics":["css","duration","milliseconds"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"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/semibran.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}},"created_at":"2016-11-18T07:12:38.000Z","updated_at":"2018-05-22T16:05:46.000Z","dependencies_parsed_at":"2022-09-01T04:21:41.537Z","dependency_job_id":null,"html_url":"https://github.com/semibran/css-duration","commit_stats":null,"previous_names":["grandonbroseph/css-duration"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fcss-duration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fcss-duration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fcss-duration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fcss-duration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/semibran","download_url":"https://codeload.github.com/semibran/css-duration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247485291,"owners_count":20946398,"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":["css","duration","milliseconds"],"created_at":"2024-10-09T21:29:55.744Z","updated_at":"2026-05-19T02:01:54.589Z","avatar_url":"https://github.com/semibran.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# css-duration\n\n\u003e Converts CSS-style durations to milliseconds.\n\n```javascript\nvar duration = require(\"css-duration\")\n\nduration('1000ms')\n// \u003e 1000\n\nduration('1.5s')\n// \u003e 1500\n\nduration('30m')\n// \u003e 1800000\n\nduration('8h')\n// \u003e 28800000\n\nduration('2d')\n// \u003e 172800000\n```\n\n## Installation\n\n`npm install --save css-duration`\n\n## Usage\n\n### `duration(time)`\n\nNormalizes \"unit-based time\" (similar to CSS values) into a `Number` of milliseconds.\n\n#### Parameters\n\n - `time` (`String`): A CSS-style value of a duration of time (i.e. `10s`, `5h`, `0.5d`)\n\n#### Units\n\n - `ms`: Milliseconds\n - `s`: Seconds\n - `h`: Hours\n - `d`: Days\n - `w`: Weeks\n\n**Note:** Anything past seconds is not a valid CSS unit.  Use another package for validating.\n\n#### Example\n\n```js\nduration('0.25d')\n// =\u003e 21600000\n\nduration('-1w')\n// =\u003e -604800000\n```\n\n## License\n\nMIT © [Brandon Semilla](https://github.com/grandonbroseph)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemibran%2Fcss-duration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsemibran%2Fcss-duration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemibran%2Fcss-duration/lists"}