{"id":22092212,"url":"https://github.com/pirxpilot/okres","last_synced_at":"2026-03-15T12:20:39.082Z","repository":{"id":57314063,"uuid":"81236117","full_name":"pirxpilot/okres","owner":"pirxpilot","description":"Localized formatting for durations","archived":false,"fork":false,"pushed_at":"2024-12-05T16:57:23.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-16T20:16:38.605Z","etag":null,"topics":["duration","i18n","l10n"],"latest_commit_sha":null,"homepage":null,"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/pirxpilot.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.md","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":"2017-02-07T17:43:13.000Z","updated_at":"2024-12-05T16:57:28.000Z","dependencies_parsed_at":"2022-09-20T23:21:38.671Z","dependency_job_id":null,"html_url":"https://github.com/pirxpilot/okres","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Fokres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Fokres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Fokres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Fokres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pirxpilot","download_url":"https://codeload.github.com/pirxpilot/okres/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237684649,"owners_count":19350026,"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":["duration","i18n","l10n"],"created_at":"2024-12-01T03:08:46.123Z","updated_at":"2026-03-15T12:20:39.074Z","avatar_url":"https://github.com/pirxpilot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM version][npm-image]][npm-url]\n[![Build Status][build-image]][build-url]\n[![Dependency Status][deps-image]][deps-url]\n\n# okres\n\nLocalized formatting for duration. It's a small subset of the [moment] functionality to be used on\nthe client.\n\nModern browsers support localized [DateTimeFormat], but localized duration formatting is not part of\nthe standard. This modules takes a subset of [moment] localization data to fill that gap.\n\n## Install\n\n```sh\n$ npm install --save okres\n```\n\n## Usage\n\n```js\nvar okres = require('okres');\n\nokres({ hours: 10, minute: 5 });         // 10 hours 5 minutes\nokres({ hours: 10 }, { future: true });  // in 10 hours\n\nvar okres_pl = okres('pl');\n\nokres_pl({ day: 3, minute: 0 }, { showZero: true });  // 3 dni 0 minut\nokres_pl({ minute: 5 }, { past: true });              // 5 minut temu\n\n```\n\n## API\n\n### `okres(locale)`\n\nreturns a formatting function for a specified locale, if locale is not specified built-in English\nlocale is used\n\nThe module defining the `locale` needs to be loaded as well.\n\n```js\nrequire('okres/locale/pl')    // loads a single (in this case Polish) locale\nrequire('okres/locale');      // loads all available locales\n```\n\n### `okres(duration, options)`\n\nreturns formatted string representing `duration`\n\n- `duration` - { year, month, day, hour, minute } - if period is not specified it is skipped in\n  a formatted string\n- `options.showZero` - if truthy format will include 0 amounts, otherwise zero amounts are skipped\n- `options.future` - set to make format include future indication e.g. 'in 5 hours'\n- `options.past` - set to make format include past indication e.g. '5 hours ago'\n\n## Locales\n\n`okres` locales can be created from [moment] locales by removing all parts with the exception of\n`relativeTime` and - optionally - `postformat` function.\n\n## License\n\nMIT © [Damian Krzeminski](https://pirxpilot.me)\n\n[moment]: http://momentjs.com/\n[DateTimeFormat]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n\n[npm-image]: https://img.shields.io/npm/v/okres\n[npm-url]: https://npmjs.org/package/okres\n\n[build-url]: https://github.com/pirxpilot/okres/actions/workflows/check.yaml\n[build-image]: https://img.shields.io/github/actions/workflow/status/pirxpilot/okres/check.yaml?branch=main\n\n[deps-image]: https://img.shields.io/librariesio/release/npm/okres\n[deps-url]: https://libraries.io/npm/okres\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpirxpilot%2Fokres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpirxpilot%2Fokres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpirxpilot%2Fokres/lists"}