{"name":"humanize-duration","author":{"name":"Evan Hahn","email":"me@evanhahn.com","url":"https://evanhahn.com"},"contributors":[{"name":"Óli Tómas Freysson","url":"https://github.com/olitomas"},{"name":"Martin Prins","url":"https://github.com/magarcia"},{"name":"Filipi Siqueira","url":"https://github.com/filipi777"},{"name":"Peter Rekdal Sunde","url":"https://github.com/peters"},{"name":"Michał Janiec","url":"https://github.com/mjjaniec"},{"name":"Eileen Li","url":"https://github.com/eileen3"},{"name":"Tommy Brunn","url":"https://github.com/Nevon"},{"name":"Giovanni Pellerano","url":"https://github.com/evilaliv3"},{"name":"Rahma Sghaier","url":"https://twitter.com/sghaierrahma"},{"name":"Evgenios Kastanias","url":"https://github.com/evgenios"},{"name":"Oleksii Mylotskyi","url":"https://github.com/spalax"},{"name":"Matthew Brandly","url":"https://github.com/brandly"},{"name":"Patrik Simek","url":"https://github.com/patriksimek"},{"name":"Toni Helminen","url":"https://github.com/tonihelminen"},{"name":"Vidmantas Drasutis","url":"https://github.com/drasius2"},{"name":"Manh Tuan","url":"https://github.com/J2TeaM"},{"name":"Leonard Lee","url":"https://github.com/sheeeng"},{"name":"Jesse Jackson","url":"https://github.com/jsejcksn"},{"name":"Caner Elci","url":"https://github.com/canerelci"},{"name":"Matej Kolesár","url":"https://github.com/rasel-sk"},{"name":"Abdul Jalil","url":"https://github.com/abduljalilm94"},{"name":"Alex Sam","url":"https://github.com/sam-lex"},{"name":"Wasuwat Limsuparhat","url":"https://github.com/rappad"},{"name":"Harijs Deksnis","url":"https://github.com/arcanous"},{"name":"Neer Thapa","url":"Subit"},{"name":"Fahad Kassim","url":"https://github.com/fadsel"}],"version":"3.23.0","description":"Convert millisecond durations to English and many other languages.","homepage":"https://github.com/EvanHahn/HumanizeDuration.js","main":"humanize-duration.js","scripts":{"pretest":"standard --fix","test":"mocha"},"devDependencies":{"check-ecmascript-version-compatibility":"^0.1.1","csv-parse":"^4.10.1","mocha":"^7.1.2","ms":"^2.1.2","standard":"^14.3.4"},"keywords":["humanize","duration","time","hours","minutes","seconds","days","years","months"],"repository":{"type":"git","url":"git://github.com/EvanHahn/HumanizeDuration.js.git"},"bugs":{"url":"https://github.com/EvanHahn/HumanizeDuration.js/issues"},"license":"Unlicense","standard":{"globals":["define","describe","it","before"]},"gitHead":"7427a33fdaa6d6fbb270b8136cbf357e7eba2066","_id":"humanize-duration@3.23.0","_nodeVersion":"14.2.0","_npmVersion":"6.14.4","dist":{"integrity":"sha512-ToVp8+w3PkP/iL5OklJn9+uW1WRuJVa0PvC6DfWlY769+UpTw5Hjr/6FP1QK/DeUklzOlvYs3faBnGUEDUXeRA==","shasum":"db401c53435223d37b2bad6030b30faaab0ee9be","tarball":"http://registry-npm.ywwl.com/humanize-duration/download/humanize-duration-3.23.0.tgz","fileCount":6,"unpackedSize":49176,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJexpP5CRA9TVsSAnZWagAAtRMQAIDLwhqi/NBvXeWpQ7l3\nur8y+6e9Z3P36ALxRxxLCTLy71Q/k5cPfQzZdaqP/tMvinF/hp8CXzdMLFNT\nHGF7ourg6ZBiYA/nbD/fOUlGE/RG4CDCTpg10UWsgr6AuKkUBqs4WVnIEsJY\nPiLr6xGgUaXymMZ3ILpZUr/Q7x0GtJo5y68JMxvnp8sAcgc9pvQha+JO2UFW\n1dSUwQ3phIWKb3iMr/vy5+7TOcA13ueuaqdMN2JXxp/7xd72BWZolLrI8hM1\nZpUQZ0/8tWowdp8XeM3toUH20bLOOtw4Vzq5zW3YNGet1bl/ZYrhmeCoumM1\nM2V9qVoHYuei/FXXhU1DFKDX6UfpZj/RUzhvFDiM8vFHyzLHdDVpl0hMg5ks\ncK2orjOYnVNJhHm8xyGFFzOF8tokBEPMkdlIizrgqe4OR4rGGBaqcQgX2UW0\nchkYNv+hNASuEIw/hYvJQMwVmOprP9+69bRwuZCyx1K4D9eQ+W7SWsf/CgqZ\nZuf3wCTSMIMadR289tgDMFsiD2Wi5IVF4aNpPnyXV5dJ/IrQzBrt446a5JTT\nixHjq5sISeZEJdCQFykDnSq5AqVsn0z+VdxShQ+O1oJlIia6cfdnQAVwTisq\nvtwHxSPSxSSGlK1YdWuX0563HatD+dySEhagyE+H+7shl/kagEZKfOAlNv7C\nBkty\r\n=tyim\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEoxNVFWNv750dSkKmk6lhGNV0vidbRcyfbBph6I6B/QIgPLSwgETNmh6WLKaan2Fs3peWdMlEbNMs7ARvH1posBI="}],"size":12812,"noattachment":false,"key":"/humanize-duration/-/humanize-duration-3.23.0.tgz"},"maintainers":[{"name":"evanhahn","email":"me@evanhahn.com"}],"_npmUser":{"name":"evanhahn","email":"me@evanhahn.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/humanize-duration_3.23.0_1590072312647_0.9280588570766108"},"_hasShrinkwrap":false,"readme":"# Humanize Duration\n\n[![npm version](https://badge.fury.io/js/humanize-duration.svg)](https://npmjs.org/package/humanize-duration)\n\nI have the time in milliseconds and I want it to become \"30 minutes\" or \"3 days, 1 hour\". Enter Humanize Duration!\n\n**This library is actively maintained but no new features will be added.**\n\n## Installation\n\nThis package is available as _humanize-duration_ on [npm](https://www.npmjs.com/package/humanize-duration) and Bower. You can also include the JavaScript file in the browser.\n\n```sh\nnpm install humanize-duration\n```\n\n## Basic usage\n\nWith `require` (like in Node or with common build systems):\n\n```js\nconst humanizeDuration = require(\"humanize-duration\");\nhumanizeDuration(12000);\n// => \"12 seconds\"\n```\n\nWith a `<script>` tag:\n\n```html\n<script src=\"humanize-duration.js\"></script>\n<script>\n  humanizeDuration(12000);\n</script>\n```\n\nBy default, Humanize Duration will humanize down to the second, and will return a decimal for the smallest unit. It will humanize in English by default.\n\n```js\nhumanizeDuration(3000);\n// => \"3 seconds\"\n\nhumanizeDuration(2250);\n// => \"2.25 seconds\"\n\nhumanizeDuration(97320000);\n// => \"1 day, 3 hours, 2 minutes\"\n```\n\n## Options\n\nYou can change the settings by passing options as the second argument.\n\n### language\n\nLanguage for unit display. Accepts an [ISO 639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) from one of the [supported languages](#supported-languages).\n\nDefault: `\"en\"`.\n\n```js\nhumanizeDuration(3000, { language: \"es\" });\n// => \"3 segundos\"\n\nhumanizeDuration(5000, { language: \"ko\" });\n// => \"5 초\"\n```\n\n### fallbacks\n\nArray of fallback languages, if the provided language cannot be found. Like `language`, accepts an [ISO 639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) from one of the [supported languages](#supported-languages). It works from left to right, choosing the first language that's found.\n\nDefault: `[]`.\n\n```js\nhumanizeDuration(3000, {\n  language: \"bad language\",\n  fallbacks: [\"en\"],\n});\n// => \"3 seconds\"\n\nhumanizeDuration(3000, {\n  language: \"bad language\",\n  fallbacks: [\"another bad language\", \"es\"],\n});\n// => \"3 segundos\"\n```\n\n### units\n\nArray of possible units to use. Units are `y`, `mo`, `w`, `d`, `h`, `m`, `s`, and `ms`.\n\nUnits are skipped if their count is zero. For example, if you pass a duration of `1000` and units `[\"h\", \"m\", \"s\"]`, the output will be \"1 second\".\n\nMust be in descending order of unit size. For example, `[\"h\", \"m\"]` is valid but `[\"m\", \"h\"]` is not.\n\nDefault: `[\"y\", \"mo\", \"w\", \"d\", \"h\", \"m\", \"s\"]`\n\n```js\nhumanizeDuration(69000, { units: [\"h\", \"m\", \"s\", \"ms\"] });\n// => \"1 minute, 9 seconds\"\n\nhumanizeDuration(3600000, { units: [\"h\"] });\n// => \"1 hour\"\n\nhumanizeDuration(3600000, { units: [\"m\"] });\n// => \"60 minutes\"\n\nhumanizeDuration(3600000, { units: [\"d\", \"h\"] });\n// => \"1 hour\"\n```\n\n### largest\n\nInteger representing the maximum number of units to use.\n\nDefault: `Infinity`\n\n```js\nhumanizeDuration(1000000000000);\n// => \"31 years, 8 months, 1 week, 19 hours, 46 minutes, 40 seconds\"\n\nhumanizeDuration(1000000000000, { largest: 2 });\n// => \"31 years, 8 months\"\n```\n\n### round\n\nA boolean that, if `true`, rounds the smallest unit.\n\nDefault: `false`\n\n```js\nhumanizeDuration(1200);\n// => \"1.2 seconds\"\n\nhumanizeDuration(1200, { round: true });\n// => \"1 second\"\n\nhumanizeDuration(1600, { round: true });\n// => \"2 seconds\"\n```\n\n### delimiter\n\nString to display between units.\n\nDefault: `\", \"` in most languages, `\" ﻭ \"` for Arabic\n\n```js\nhumanizeDuration(22140000);\n// => \"6 hours, 9 minutes\"\n\nhumanizeDuration(22140000, { delimiter: \" and \" });\n// => \"6 hours and 9 minutes\"\n```\n\n### spacer\n\nString to display between the count and the word.\n\nDefault: `\" \"`\n\n```js\nhumanizeDuration(260040000);\n// => \"3 days, 14 minutes\"\n\nhumanizeDuration(260040000, { spacer: \" whole \" });\n// => \"3 whole days, 14 whole minutes\"\n```\n\n### decimal\n\nString to display between the integer and decimal parts of a count, if relevant.\n\nDefault depends on the language.\n\n```js\nhumanizeDuration(1200);\n// => \"1.2 seconds\"\n\nhumanizeDuration(1200, { decimal: \" point \" });\n// => \"1 point 2 seconds\"\n```\n\n### conjunction\n\nString to include before the final unit.\n\nYou can also set `serialComma` to `false` to eliminate the final comma.\n\nDefault: `\"\"`\n\n```js\nhumanizeDuration(22140000, { conjunction: \" and \" });\n// => \"6 hours and 9 minutes\"\n\nhumanizeDuration(22141000, { conjunction: \" and \" });\n// => \"6 hours, 9 minutes, and 1 second\"\n\nhumanizeDuration(22140000, { conjunction: \" and \", serialComma: false });\n// => \"6 hours and 9 minutes\"\n\nhumanizeDuration(22141000, { conjunction: \" and \", serialComma: false });\n// => \"6 hours, 9 minutes and 1 second\"\n```\n\n### maxDecimalPoints\n\nInteger that defines the maximum number of decimal points to show, if relevant. If `undefined`, the count will be converted to a string using [`Number.prototype.toString()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString).\n\nThis does not round any numbers. See [the `round` option](#round).\n\nDefault: `undefined`\n\n```js\nhumanizeDuration(8123.456789);\n// => \"8.123456789 seconds\"\n\nhumanizeDuration(8123.456789, { maxDecimalPoints: 3 });\n// => \"8.123 seconds\"\n\nhumanizeDuration(8100, { maxDecimalPoints: 99 });\n// => \"8.1 seconds\"\n\nhumanizeDuration(8000, { maxDecimalPoints: 99 });\n// => \"8 seconds\"\n\nhumanizeDuration(7999, { maxDecimalPoints: 2 });\n// => \"7.99 seconds\"\n```\n\n### digitReplacements\n\nArray of ten strings to which will replace the numerals 0-9. Useful if a language uses different numerals.\n\nDefault: `undefined` for most languages, `[\"۰\", \"١\", \"٢\", \"٣\", \"٤\", \"٥\", \"٦\", \"٧\", \"٨\", \"٩\"]` for Arabic\n\n```js\nhumanizeDuration(1234);\n// => \"1.234 seconds\"\n\nhumanizeDuration(1234, {\n  digitReplacements: [\n    \"Zero\",\n    \"One\",\n    \"Two\",\n    \"Three\",\n    \"Four\",\n    \"Five\",\n    \"Six\",\n    \"Seven\",\n    \"Eight\",\n    \"Nine\",\n  ],\n});\n// => \"One.TwoThreeFour seconds\"\n```\n\n### unitMeasures\n\n_Use this option with care. It is an advanced feature._\n\nObject used to customize the value used to calculate each unit of time. Most useful when you want to update the length of years or months, which have ambiguous lengths.\n\nDefault: `{ y: 31557600000, mo: 2629800000, w: 604800000, d: 86400000, h: 3600000, m: 60000, s: 1000, ms: 1 }`\n\n```js\nhumanizeDuration(2629800000);\n// => \"1 month\"\n\nhumanizeDuration(2629800000, {\n  unitMeasures: {\n    y: 31557600000,\n    mo: 30 * 86400000,\n    w: 604800000,\n    d: 86400000,\n    h: 3600000,\n    m: 60000,\n    s: 1000,\n    ms: 1,\n  },\n});\n// => \"1 month, 10 hours, 30 minutes\"\n```\n\n## Humanizers\n\nIf you find yourself setting same options over and over again, you can create a _humanizer_ that changes the defaults, which you can still override later.\n\n```js\nconst spanishHumanizer = humanizeDuration.humanizer({\n  language: \"es\",\n  units: [\"y\", \"mo\", \"d\"],\n});\n\nspanishHumanizer(71177400000);\n// => \"2 años, 3 meses, 2 días\"\n\nspanishHumanizer(71177400000, { units: [\"d\", \"h\"] });\n// => \"823 días, 19.5 horas\"\n```\n\nYou can also add new languages to humanizers. For example:\n\n```js\nconst shortEnglishHumanizer = humanizeDuration.humanizer({\n  language: \"shortEn\",\n  languages: {\n    shortEn: {\n      y: () => \"y\",\n      mo: () => \"mo\",\n      w: () => \"w\",\n      d: () => \"d\",\n      h: () => \"h\",\n      m: () => \"m\",\n      s: () => \"s\",\n      ms: () => \"ms\",\n    },\n  },\n});\n\nshortEnglishHumanizer(15600000);\n// => \"4 h, 20 m\"\n```\n\nYou can also add languages after initializing:\n\n```js\nconst humanizer = humanizeDuration.humanizer();\n\nhumanizer.languages.shortEn = {\n  y: () => \"y\",\n  // ...\n```\n\nInternally, the main `humanizeDuration` function is just a wrapper around a humanizer.\n\n## Supported languages\n\nHumanize Duration supports the following languages:\n\n| Language             | Code     |\n| -------------------- | -------- |\n| Afrikaans            | `af`     |\n| Albanian             | `sq`     |\n| Amharic              | `am`     |\n| Arabic               | `ar`     |\n| Basque               | `eu`     |\n| Bengali              | `bn`     |\n| Bulgarian            | `bg`     |\n| Catalan              | `ca`     |\n| Central Kurdish      | `ckb`    |\n| Chinese, simplified  | `zh_CN`  |\n| Chinese, traditional | `zh_TW`  |\n| Croatian             | `hr`     |\n| Czech                | `cs`     |\n| Danish               | `da`     |\n| Dutch                | `nl`     |\n| English              | `en`     |\n| Esperanto            | `eo`     |\n| Estonian             | `et`     |\n| Faroese              | `fo`     |\n| Farsi/Persian        | `fa`     |\n| Finnish              | `fi`     |\n| French               | `fr`     |\n| German               | `de`     |\n| Greek                | `el`     |\n| Hebrew               | `he`     |\n| Hindi                | `hi`     |\n| Hungarian            | `hu`     |\n| Icelandic            | `is`     |\n| Indonesian           | `id`     |\n| Italian              | `it`     |\n| Japanese             | `ja`     |\n| Kannada              | `kn`     |\n| Khmer                | `km`     |\n| Korean               | `ko`     |\n| Kurdish              | `ku`     |\n| Lao                  | `lo`     |\n| Latvian              | `lv`     |\n| Lithuanian           | `lt`     |\n| Macedonian           | `mk`     |\n| Mongolian            | `mn`     |\n| Malay                | `ms`     |\n| Marathi              | `mr`     |\n| Norwegian            | `no`     |\n| Polish               | `pl`     |\n| Portuguese           | `pt`     |\n| Romanian             | `ro`     |\n| Russian              | `ru`     |\n| Serbian              | `sr`     |\n| Slovak               | `sk`     |\n| Slovenian            | `sl`     |\n| Spanish              | `es`     |\n| Swahili              | `sw`     |\n| Swedish              | `sv`     |\n| Tamil                | `ta`     |\n| Telugu               | `te`     |\n| Thai                 | `th`     |\n| Turkish              | `tr`     |\n| Ukrainian            | `uk`     |\n| Urdu                 | `ur`     |\n| Uzbek                | `uz`     |\n| Uzbek (Cyrillic)     | `uz_CYR` |\n| Vietnamese           | `vi`     |\n| Welsh                | `cy`     |\n\nFor a list of supported languages, you can use the `getSupportedLanguages` function. The results may not be in the same order every time.\n\n```js\nhumanizeDuration.getSupportedLanguages();\n// => [\"af\", \"ar\", \"bg\", \"bn\", \"ca\", ...]\n```\n\nThis function won't return any new languages you define; it will only return the defaults supported by the library.\n\n## Credits\n\nLovingly made by [Evan Hahn](https://evanhahn.com/) with help from:\n\n- [Martin Prins](https://github.com/magarcia) for language support\n- [Filipi Siqueira](https://github.com/filipi777) for Portuguese support\n- [Peter Rekdal Sunde](https://github.com/peters) for Norwegian support\n- [Michał Janiec](https://github.com/mjjaniec) for Polish support\n- [Eileen Li](https://github.com/eileen3) for Chinese support\n- [Tommy Brunn](https://github.com/Nevon) for Swedish support\n- [Giovanni Pellerano](https://github.com/evilaliv3) for Italian support\n- [Rahma Sghaier](https://twitter.com/sghaierrahma) for Arabic support\n- [Evgenios Kastanias](https://github.com/evgenios) for Greek support\n- [Oleksii Mylotskyi](https://github.com/spalax) for Ukrainian support\n- [Patrik Simek](https://github.com/patriksimek) for Czech support\n- [Toni Helminen](https://github.com/tonihelminen) for Finnish support\n- [Vidmantas Drasutis](https://github.com/Drasius2) for Lithuanian support\n- [Manh Tuan](https://github.com/J2TeaM) for Vietnamese support\n- [Leonard Lee](https://github.com/sheeeng) for Indonesian & Malay support\n- [Jesse Jackson](https://github.com/jsejcksn) for documentation help\n- [Óli Tómas Freysson](https://github.com/olitomas) for Icelandic support\n- [Saeed Ganji](https://github.com/shahabganji) for Farsi/Persian support\n- [Caner Elci](https://github.com/canerelci) for Bulgarian support\n- [Matej Kolesár](https://github.com/rasel-sk) for Slovak support\n- [Abdul Jalil](https://github.com/abduljalilm94) for Urdu support\n- [Wasuwat Limsuparhat](https://github.com/rappad) for Thai support\n- Malikoun for Lao support\n- [Villu Orav](https://github.com/villu164) for Estonian support\n- [Harijs Deksnis](https://github.com/arcanous) for Latvian support\n- [Nirmala Thapa(Subit)](https://github.com/nirmalathapa) for Faroese support\n- [Fahad Kassim](https://github.com/fadsel) for Swahili support\n- [Prayag Roy Choudhury](https://github.com/BeardyGod) for updating Mocha\n- [Aryan Rawlani](https://github.com/aryanrawlani28) for Hindi support\n- [Kristijan Jesenski](https://github.com/kjesenski) for Slovenian support\n- [Michal Karzel](https://github.com/Misioka) for improving Arabic support\n- [Mikias Menjeta](https://github.com/OMikiasO) for Amharic support\n\nLicensed under the permissive [Unlicense](https://unlicense.org/). Enjoy!\n\n## Related modules\n\n- [pretty-ms](https://github.com/sindresorhus/pretty-ms)\n- [angularjs-humanize-duration](https://github.com/sebastianhaas/angularjs-humanize-duration)\n- [millisec](https://github.com/sungwoncho/millisec)\n- [HumanizeDuration.ts](https://github.com/Nightapes/HumanizeDuration.ts), a TypeScript version of this module\n- [aurelia-time](https://github.com/shahabganji/aurelia-time)\n- [Fork that adds a `timeAdverb` option](https://github.com/cmldk/HumanizeDuration.js)\n- [Fork that provides the duration in an abbreviated format](https://github.com/rasa/HumanizeDuration.js), ex: `1d 2h 3m 4s`\n","publish_time":1590072312766,"_cnpm_publish_time":1590072312766,"dist-tags":{"latest":"3.35.1"}}