{"name":"@formatjs/intl-relativetimeformat","version":"4.4.3-alpha.7","description":"Formats JavaScript dates to relative time strings.","keywords":["intl","i18n","relative","time","moment","format","date"],"author":{"name":"Long Ho","email":"holevietlong@gmail.com"},"bugs":{"url":"https://github.com/formatjs/formatjs/issues"},"repository":{"type":"git","url":"git+ssh://git@github.com/formatjs/formatjs.git"},"devDependencies":{"@formatjs/intl-pluralrules":"^1.3.4-alpha.7+243a67e","formatjs-extract-cldr-data":"^9.9.3"},"dependencies":{"@formatjs/intl-utils":"^1.4.1"},"main":"dist/index.js","module":"lib/index.js","types":"lib/intl-relativetimeformat.d.ts","scripts":{"build":"npm run cldr && npm run compile","cldr":"ts-node --project tsconfig.cjs.json scripts/cldr","clean":"rimraf dist lib dist-es6","compile":"tsc && api-extractor run --local && tsc -p tsconfig.cjs.json && tsc -p tsconfig.es6.json && rollup -c rollup.config.js","jest":"cross-env NODE_ICU_DATA=../../node_modules/full-icu TS_NODE_PROJECT=tsconfig.cjs.json cross-env NODE_ENV=test jest","test":"npm run jest && cross-env NODE_ICU_DATA=../../node_modules/full-icu TS_NODE_PROJECT=tsconfig.cjs.json ts-node tests/runner"},"homepage":"https://github.com/formatjs/formatjs","license":"MIT","gitHead":"243a67e101a0ea31cb40a8142bbccc7838938f41","readme":"# Intl RelativeTimeFormat\n\nA spec-compliant polyfill/ponyfill for Intl.RelativeTimeFormat fully tested by the [official ECMAScript Conformance test suite](https://github.com/tc39/test262)\n\n[![npm Version][npm-badge]][npm]\n![size](https://badgen.net/bundlephobia/minzip/@formatjs/intl-relativetimeformat)\n\n## Installation\n\n```\nnpm install @formatjs/intl-relativetimeformat\n```\n\n## Requirements\n\nThis package requires the following capabilities:\n\n1. [Intl.PluralRules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/PluralRules)\n\n**NOTE: `formatToParts` only works on Node 10+ due to lack of `Intl.NumberFormat.prototype.formatToParts` natively**\n\n## Usage\n\n### Ponyfill\n\nTo use the ponyfill, import it along with its data:\n\n```tsx\nimport IntlRelativeTimeFormat from '@formatjs/intl-relativetimeformat';\n// locale-data for zh\nIntlRelativeTimeFormat.__addLocaleData(\n  require('@formatjs/intl-relativetimeformat/dist/locale-data/zh.json')\n);\n\n// locale-data for zh\nIntlRelativeTimeFormat.__addLocaleData(\n  require('@formatjs/intl-relativetimeformat/dist/locale-data/en.json')\n);\n\nnew IntlRelativeTimeFormat('zh-CN').format(-1, 'second'); // '1秒钟前'\n```\n\n### Polyfill\n\nTo use the polyfill, just import it to make sure that a fully functional Intl.RelativeTimeFormat is available in your environment:\n\n```tsx\nimport '@formatjs/intl-relativetimeformat/polyfill';\nimport '@formatjs/intl-relativetimeformat/dist/locale-data/de'; // Add locale data for de\n```\n\nIf you want to polyfill all locales (e.g for Node):\n\n```tsx\nimport '@formatjs/intl-relativetimeformat/polyfill-locales';\n```\n\n## Tests\n\nThis library is fully [test262](https://github.com/tc39/test262/tree/master/test/intl402/RelativeTimeFormat)-compliant.\n\n## License\n\nThis software is free to use under the Yahoo! Inc. BSD license.\nSee the [LICENSE file][license] for license text and copyright information.\n\n[npm]: https://www.npmjs.org/package/@formatjs/intl-relativetimeformat\n[npm-badge]: https://img.shields.io/npm/v/@formatjs/intl-relativetimeformat.svg?style=flat-square\n","readmeFilename":"README.md","_id":"@formatjs/intl-relativetimeformat@4.4.3-alpha.7","_nodeVersion":"10.16.0","_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","dist":{"integrity":"sha512-WYwFTf4DbJc55//qWXSBcKQtmWNv0kwQmplQ2+yujtxd2GipdrqoKTJlAJVBqEUIGF/5ZmhMYikMtuWWr6c7jw==","shasum":"1fdceb276688804af377f62c1c59433b52a6e739","tarball":"http://registry-npm.ywwl.com/@formatjs/intl-relativetimeformat/download/@formatjs/intl-relativetimeformat-4.4.3-alpha.7.tgz","fileCount":474,"unpackedSize":17852619,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd1h8hCRA9TVsSAnZWagAA7fcQAJBTZb6RI3XmNVrhnxyv\n4XYlHmK+CDBurqkoc4L4PCtZ+rHGBtRDIWzGlEQj0nFndT3Qaa/SWz3IHTfu\nlKT3NFGr4VO7NnLisl/Gl6nv8k78qj+sgKUsTDacDAjlrpq/JyJMuekJwLNb\nNPVUSyBs+CnEDsAyZmfaoLuNEwcc12U2bXa9IkfESDPp8B8SOBZZzJX4f6i0\nixVXRcrc/Qc6g4qrgbDDso9Rasb7MUwYDyjqRzvMvKPo5Xzet7kDe77Ubb9K\nCyPXd2xzAsMvRPchJj8jZzVPnKNtTfOJj6mxBa7mMVEnqRtjZnxI68gtC5y7\nduWIBbbkIWx/ewvFzMMW1SqtLdms6wvEvukru+jPh7iCkf2nvLJoxBxRk5wd\nmuj4HWeMIMuHv6paNp3jWobUcAvF2JQiO2t93K3O5Iv8jNFLQSuH4A+qchkw\nMmwu8jKh5gzKIKkCKjQ0vMwBdw571AMuiiz0cYSoydTeax0h/TL6P+Pg6w5F\nxwT6G3KDb6HXfUKJJ90zT04zv4idAh1+PbuUK5/vrvk7jTPqD4tsQ4XEmE3q\np4Pk5mgjPqZWjaVGjMqvWPHlDIcBjqjAyjb6e8ZLPeGs6eboyWom4/j1npLB\nE+/ZFeaOwfXYbLiJxcCUYFPSzCBicPGnIPuNerqmxiVzOg0WMiCda6Q6zAyG\nzVWl\r\n=zguh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGVR3ZUHvUQxjKcbmFak3OLLgcoTOtfiFNMg5Wgs5gZCAiB+pBnKWHtGi0yuDaGnGsh2Bclt+dOG6QrytoRRwNud3g=="}],"size":1273024,"noattachment":false,"key":"/@formatjs/intl-relativetimeformat/-/@formatjs/intl-relativetimeformat-4.4.3-alpha.7.tgz"},"maintainers":[{"email":"holevietlong@gmail.com","name":"longlho"},{"email":"seth@bertalotto.net","name":"redonkulus"}],"_npmUser":{"name":"longlho","email":"holevietlong@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/intl-relativetimeformat_4.4.3-alpha.7_1574313761122_0.25067621466113454"},"_hasShrinkwrap":false,"publish_time":1574313761478,"_cnpm_publish_time":1574313761478,"dist-tags":{"latest":"13.0.1","next":"6.0.4-alpha.0"}}