{"name":"duration","version":"0.2.2","description":"Time duration utilities","author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"keywords":["date","duration","time"],"repository":{"type":"git","url":"git://github.com/medikoo/duration.git"},"dependencies":{"d":"1","es5-ext":"~0.10.46"},"devDependencies":{"eslint":"^5.8","eslint-config-medikoo-es5":"^1.7.2","tad":"~0.2.8"},"eslintConfig":{"extends":"medikoo-es5","root":true,"rules":{"consistent-return":"off","id-length":"off"},"overrides":[{"files":"test/**","rules":{"max-lines":"off","max-statements":"off"}}]},"scripts":{"lint":"eslint --ignore-path=.gitignore .","test":"node ./node_modules/tad/bin/tad"},"license":"ISC","gitHead":"170f16b6763aaf5b02992a1ea8ddf2504469c938","bugs":{"url":"https://github.com/medikoo/duration/issues"},"homepage":"https://github.com/medikoo/duration#readme","_id":"duration@0.2.2","_npmVersion":"6.4.1","_nodeVersion":"10.10.0","_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"dist":{"integrity":"sha512-06kgtea+bGreF5eKYgI/36A6pLXggY7oR4p1pq4SmdFBn1ReOL5D8RhG64VrqfTTKNucqqtBAwEj8aB88mcqrg==","shasum":"ddf149bc3bc6901150fe9017111d016b3357f529","tarball":"http://registry-npm.ywwl.com/duration/download/duration-0.2.2.tgz","fileCount":8,"unpackedSize":45038,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb2dlvCRA9TVsSAnZWagAAFKsQAIoeI3o/GuV4EDCcwdb2\nUZT3SK8pVAHp5iDokeHsP9HtKhQ7IneMbDU3WrG4NEtfrvKQlNU5Fe8krUpK\nf7zO8hUvGJcPvDuvkvaIvwjgoitm6sObV569eD/nPP5T7ifBBFAQZxBs/o8N\nPyfIIYLcc7k2WgQUN7G7JQxBLPE7FgNsOadnDTbqV13wA2uQ2myaj0KuhQfg\nEm7LdGqN6mIWewR6/ISixUoRYM182weNDZQun9tgJ4MCMagMUJYug+3SfWPc\nIqYAfgT1/zQLwDyOgdviEijsE6lX5cVGbfT7ZH1SkX2enXP4tLZ/oSeEtuNT\nMaj4CXhX8ZasMbPivl+RvRqLtBVa6CFcJbBrrQ8spU8rVyMPaarSQ0EEBavY\nFfXkojtyrl7W2+sxpFJfEgyhOzVrN8wFfHP3/8rBf3lxBczgVkwpXjo23A8o\nXa4G6m/D2bSLgGlN5lbXaI7HM4R/DbdKt7p3FeZQZNm6e3NsX/ySkgMrRmX5\nUUaXMY9IDxA8jyKmOdleLTonWPiDXKIePpkwE5LjwJ+gq/+PCeEVgMv8wBx2\nRshn/QUa7sILBFi9/DoGYfU+BAago9lBtCY6YWlp/iUESVObKSBUQuzLXcmx\nHWhzso/GmiAX7YOe/psa/5ueussYw714ClP1zMAewsBI+7ibXDDydHx0mA19\naxol\r\n=oYDR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDjlmclCqMamr613RKgXn9ucFeevsb9mZCHtZmABemzrgIgddsxewJTg3glQFfkuxvX0soBq+OHQ+7ee1uGoSCWcXo="}],"size":7285,"noattachment":false,"key":"/duration/-/duration-0.2.2.tgz"},"maintainers":[{"name":"medikoo","email":"medikoo+npm@medikoo.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/duration_0.2.2_1541003630652_0.9413837651515293"},"_hasShrinkwrap":false,"readme":"[![*nix build status][nix-build-image]][nix-build-url]\n[![Windows build status][win-build-image]][win-build-url]\n![Transpilation status][transpilation-image]\n[![npm version][npm-image]][npm-url]\n\n# duration - Time duration utilities\n\n_Formerly part of [es5-ext](https://github.com/medikoo/es5-ext) project._\n\n## Installation\n\n### Node.js\n\n    $ npm install duration\n\n### Browser\n\nCan be bundled for browser with help of [modules-webmake](https://github.com/medikoo/modules-webmake)\n\n## Example usage:\n\n```javascript\nvar Duration = require(\"duration\");\n\nvar duration = new Duration(new Date(2000, 6, 7), new Date(2010, 8, 13, 3, 23, 8, 456));\n\nconsole.log(\"Years: \", duration.years);\nconsole.log(\"Months: \", duration.months);\nconsole.log(\"Days: \", duration.days);\nconsole.log(\"Hours: \", duration.hours);\nconsole.log(\"Minutes: \", duration.minutes);\nconsole.log(\"Seconds: \", duration.seconds);\nconsole.log(\"Milliseconds: \", duration.milliseconds);\n\nconsole.log(\"Trailing months: \", duration.month);\nconsole.log(\"Trailing days: \", duration.day);\nconsole.log(\"Trailing hours: \", duration.hour);\nconsole.log(\"Trailing minutes: \", duration.minute);\nconsole.log(\"Trailing seconds: \", duration.second);\nconsole.log(\"Trailing milliseconds: \", duration.millisecond);\n\nconsole.log(\"Default string representation: \", duration.toString());\nconsole.log(\"Alternative string representation: \", duration.toString(1));\nconsole.log(\"Custom string representation: \", duration.toString(\"H: %Hs m: %M\"));\n```\n\nOutput:\n\n```\nYears:  10\nMonths:  122\nDays:  3720\nHours:  89283\nMinutes:  5357003\nSeconds:  321420188\nMilliseconds:  321420188456\nTrailing months:  2\nTrailing days:  6\nTrailing hours:  3\nTrailing minutes:  23\nTrailing seconds:  8\nTrailing milliseconds:  456\nDefault string representation:  10y 2m 6d 03:23:08.456\nAlternative string representation:  10y 2m 6d 3h 23m 8s 456ms\nCustom string representation:  H: 89283 m: 23\n```\n\n## Duration(from[, to])\n\nMain module is both constructor and factory method, and can be used either way.  \n`from` and `to` are expected to be JavaScript Date objects. `to` is optional, and if not provided it defaults to current time.\n\n## Duration.prototype properties\n\n### years\n\nReturns full years of the duration\n\n### months\n\nReturns full months of the duration\n\n### days\n\nReturns full days of the duration\n\n### hours\n\nReturns full hours of the duration\n\n### seconds\n\nReturns full seconds of the duration\n\n### minutes\n\nReturns full minutes of the duration\n\n### milliseconds\n\nReturns milliseconds of the duration\n\n### year\n\nSame as `years`. Returns full years of the duration\n\n### month\n\nReturns trailing months of the duration\n\n### day\n\nReturns trailing days of the duration\n\n### hour\n\nReturns trailing hours of the duration\n\n### minute\n\nReturns trailing minutes of the duration\n\n### second\n\nReturns trailing seconds of the duration\n\n### millisecond\n\nReturns trailing seconds of the duration\n\n## valueOf()\n\nSame as `milliseconds`. Returns milliseconds of the duration\n\n## toString([mode[, threshold]])\n\nReturns readable representation of the duration.  \nWhen invoked without arguments (defaults to _mode=0_), returns as:\n\n    10y 2m 6d 03:23:08.456\n\nWhen invoked with mode `1`, returns alternative representation:\n\n    10y 2m 6d 3h 23m 8s 456ms\n\nRepresentation returned by default modes can be customized with threshold setting that trims lowest units:\n\n```javascript\nduration.toString(); // 10y 2m 6d 03:23:08.456\nduration.toString(0, 1); // 10y 2m 6d 03:23:08\nduration.toString(0, 2); // 10y 2m 6d 03:23\n\nduration.toString(1); // 10y 2m 6d 3h 23m 8s 456ms\nduration.toString(1, 1); // 10y 2m 6d 3h 23m 8s\nduration.toString(1, 2); // 10y 2m 6d 3h 23m\n```\n\n## toString(format)\n\nWhen invoked with string, formats the duration according to given pattern, where:\n\n-   `%y` - `duration.year`\n-   `%m` - `duration.month`\n-   `%d` - `duration.day`\n-   `%H` - `duration.hour`\n-   `%M` - `duration.minute`\n-   `%S` - `duration.second`\n-   `%L` - `duration.millisecond`\n-   `%ms` - `duration.months`\n-   `%ds` - `duration.days`\n-   `%Hs` - `duration.hours`\n-   `%Ms` - `duration.minutes`\n-   `%Ss` - `duration.seconds`\n-   `%Ls` - `duration.milliseconds`\n-   `%sign` - If duration is negative outputs `-` otherwise empty string\n\n## Tests\n\n    $ npm test\n\n[nix-build-image]: https://semaphoreci.com/api/v1/medikoo-org/duration/branches/master/shields_badge.svg\n[nix-build-url]: https://semaphoreci.com/medikoo-org/duration\n[win-build-image]: https://ci.appveyor.com/api/projects/status/nt9c72n1ay9coree?svg=true\n[win-build-url]: https://ci.appveyor.com/project/medikoo/duration\n[transpilation-image]: https://img.shields.io/badge/transpilation-free-brightgreen.svg\n[npm-image]: https://img.shields.io/npm/v/duration.svg\n[npm-url]: https://www.npmjs.com/package/duration\n","publish_time":1541003630790,"_cnpm_publish_time":1541003630790,"dist-tags":{"latest":"0.2.2"}}