@formatjs/intl-relativetimeformat 4.5.12 → 4.5.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/README.md +1 -61
- package/dist/polyfill-with-locales-for-test262.js +2 -1
- package/dist/polyfill-with-locales-for-test262.js.map +1 -1
- package/dist/polyfill-with-locales.js +2 -1
- package/dist/polyfill-with-locales.js.map +1 -1
- package/dist/umd/intl-relativetimeformat-with-locales.js +2 -1
- package/dist/umd/intl-relativetimeformat-with-locales.js.map +1 -1
- package/dist/umd/intl-relativetimeformat-with-locales.min.js +1 -1
- package/dist/umd/intl-relativetimeformat-with-locales.min.js.map +1 -1
- package/dist/umd/intl-relativetimeformat.js +2 -1
- package/dist/umd/intl-relativetimeformat.js.map +1 -1
- package/dist/umd/intl-relativetimeformat.min.js +1 -1
- package/dist/umd/intl-relativetimeformat.min.js.map +1 -1
- package/dist/umd/polyfill-intl-relativetimeformat.js +2 -1
- package/dist/umd/polyfill-intl-relativetimeformat.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +13 -11
- package/polyfill-locales.js +215 -1
- package/polyfill.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.5.16](https://github.com/formatjs/formatjs/compare/@formatjs/intl-relativetimeformat@4.5.15...@formatjs/intl-relativetimeformat@4.5.16) (2020-05-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @formatjs/intl-relativetimeformat
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [4.5.15](https://github.com/formatjs/formatjs/compare/@formatjs/intl-relativetimeformat@4.5.14...@formatjs/intl-relativetimeformat@4.5.15) (2020-05-05)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @formatjs/intl-relativetimeformat
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 4.5.14 (2020-04-28)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @formatjs/intl-relativetimeformat
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [4.5.13](https://github.com/formatjs/formatjs/compare/@formatjs/intl-relativetimeformat@4.5.12...@formatjs/intl-relativetimeformat@4.5.13) (2020-04-24)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* **eslint-plugin-formatjs:** add missing dep ([776390e](https://github.com/formatjs/formatjs/commit/776390e9d6cb3bc1eef07b2e92057136cfe95b76))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
6
41
|
## [4.5.12](https://github.com/formatjs/formatjs/compare/@formatjs/intl-relativetimeformat@4.5.11...@formatjs/intl-relativetimeformat@4.5.12) (2020-04-14)
|
|
7
42
|
|
|
8
43
|
|
package/README.md
CHANGED
|
@@ -1,63 +1,3 @@
|
|
|
1
1
|
# Intl RelativeTimeFormat
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[![npm Version][npm-badge]][npm]
|
|
6
|
-

|
|
7
|
-
|
|
8
|
-
## Installation
|
|
9
|
-
|
|
10
|
-
```
|
|
11
|
-
npm install @formatjs/intl-relativetimeformat
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Requirements
|
|
15
|
-
|
|
16
|
-
This package requires the following capabilities:
|
|
17
|
-
|
|
18
|
-
1. [Intl.PluralRules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/PluralRules)
|
|
19
|
-
|
|
20
|
-
**NOTE: `formatToParts` only works on Node 10+ due to lack of `Intl.NumberFormat.prototype.formatToParts` natively**
|
|
21
|
-
|
|
22
|
-
## Usage
|
|
23
|
-
|
|
24
|
-
### Ponyfill
|
|
25
|
-
|
|
26
|
-
To use the ponyfill, import it along with its data:
|
|
27
|
-
|
|
28
|
-
```tsx
|
|
29
|
-
import IntlRelativeTimeFormat from '@formatjs/intl-relativetimeformat';
|
|
30
|
-
// locale-data for zh
|
|
31
|
-
IntlRelativeTimeFormat.__addLocaleData(
|
|
32
|
-
require('@formatjs/intl-relativetimeformat/dist/locale-data/zh.json')
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
// locale-data for zh
|
|
36
|
-
IntlRelativeTimeFormat.__addLocaleData(
|
|
37
|
-
require('@formatjs/intl-relativetimeformat/dist/locale-data/en.json')
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
new IntlRelativeTimeFormat('zh-CN').format(-1, 'second'); // '1秒钟前'
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### Polyfill
|
|
44
|
-
|
|
45
|
-
To use the polyfill, just import it to make sure that a fully functional Intl.RelativeTimeFormat is available in your environment:
|
|
46
|
-
|
|
47
|
-
```tsx
|
|
48
|
-
import '@formatjs/intl-relativetimeformat/polyfill';
|
|
49
|
-
import '@formatjs/intl-relativetimeformat/dist/locale-data/de'; // Add locale data for de
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
If you want to polyfill all locales (e.g for Node):
|
|
53
|
-
|
|
54
|
-
```tsx
|
|
55
|
-
import '@formatjs/intl-relativetimeformat/polyfill-locales';
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Tests
|
|
59
|
-
|
|
60
|
-
This library is fully [test262](https://github.com/tc39/test262/tree/master/test/intl402/RelativeTimeFormat)-compliant.
|
|
61
|
-
|
|
62
|
-
[npm]: https://www.npmjs.org/package/@formatjs/intl-relativetimeformat
|
|
63
|
-
[npm-badge]: https://img.shields.io/npm/v/@formatjs/intl-relativetimeformat.svg?style=flat-square
|
|
3
|
+
We've migrated the docs to https://formatjs.io.
|
|
@@ -129,7 +129,8 @@
|
|
|
129
129
|
// NOTE: we must NOT call `supportedLocalesOf` of a formatjs polyfill, or their implementation
|
|
130
130
|
// will even eventually call this method recursively. Here we use `Intl.DateTimeFormat` since it
|
|
131
131
|
// is not polyfilled by `@formatjs`.
|
|
132
|
-
|
|
132
|
+
// TODO: Fix TypeScript type def for this bc undefined is just fine
|
|
133
|
+
return Intl.DateTimeFormat.supportedLocalesOf(locales);
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
var __extends = (undefined && undefined.__extends) || (function () {
|