UNPKG

13.1 kBMarkdownView Raw
1<!--
2TO DO: Maybe change from string style names to configurable style options. Example: twitter-minute-now -> "twitter", { startFrom: 'minute', now: true }. twitter-first-minute -> "twitter", { startFrom: 'minute', startFromValue: 1 }.
3
4TO DO: Maybe require `minTime` on all steps (except the first one).
5
6TO DO: Remove the legacy compatibility of getting "now" label from "long.second.current" in runtime code (not in locale generation code — that one's as intended).
7
8TO DO: Obtaining "now" label in runtime when not using the polyfill:
9
10```js
11new Intl.RelativeTimeFormat("en", { numeric: "auto" }).format(0, 'second')
12// Outputs "now".
13```
14
15TO DO: Remove deprecated `tiny` locale labels.
16
17TO DO: Remove "defaultLocale = 'en'": a developer will have to specify their own default locale.
18
19TO DO: Maybe create a "dummy" `time-ago-js` package that would simply re-export `javascript-time-ago`.
20
21TO DO: Added the ability to use native `Intl.RelativeTimeFormat` instead of the polyfill.
22
23TO DO: (maybe, or maybe not) Steps' `format()` function now always receives a `Date` as the first argument (or maybe a `number` timestamp is better for most cases).
24
25TO DO: Maybe remove `granularity` property of steps ("Perhaps this feature will be removed because there seem to be no use cases of it in the real world" in the readme).
26
27TO DO: Change default style to "round".
28
29TO DO: Maybe remove `style.units` parameter.
30
31TO DO: "time" style should use "round" scale instead of "approximate".
32
33TO DO: if `style` is passed as an object then maybe it should be passed as part of `options` (and document that in the "Custom" section of the readme).
34-->
35
362.3.6 / 25.05.2021
37==================
38
39* [Added](https://github.com/catamphetamine/javascript-time-ago/pull/47) `mini` style (aka `twitter` style) for some locales: `da`, `sv`, `nl`, `it`, `fr`, `es`. By [@trustpilot](https://github.com/trustpilot).
40
412.3.5 / 12.05.2021
42==================
43
44* Added [additional `pt` locale styles](https://github.com/catamphetamine/javascript-time-ago/pull/45) by [Victor Biasibetti](https://github.com/victorbiasibetti).
45
462.3.3 / 11.11.2020
47==================
48
49* Changed the default `style` from `"approximate"` (legacy) to `"round-minute"`. This isn't a "breaking change" because no application would be "broken" by something like that, and relative time would still be shown in a similar way, only without too much approximation.
50
512.3.1 / 20.10.2020
52==================
53
54* (advanced) Renamed `getMinTimeToFrom()` to `getMinTimeForUnit()`.
55
562.3.0 / 14.10.2020
57==================
58
59* `test(timestamp)` function of a step is now deprecated. Use `minTime(timestamp)` function instead.
60
61* Fixed `getTimeToNextUpdate()`.
62
63* Renamed `"mini-time"` labels to `"mini"`.
64
65* Added styles: `"mini"`, `"mini-now"`, `"mini-minute"`, `"mini-minute-now"`.
66
67* Added a new `round` property (described in the readme): it can be `"round"` or `"floor"`. The default is `"round"`.
68
69* (Could be a breaking change for those who read `"tiny"` from JSON files directly) Removed "tiny" labels from JSON files. `"tiny"` labels type name still works.
70
712.2.9 / 14.10.2020
72==================
73
74* Fixed `"twitter-..."` styles.
75
762.2.8 / 12.10.2020
77==================
78
79* Added `"twitter-minute-now"` style.
80
81* The threshold for `"now"` -> `"1m"`/`"1 minute ago"` is now 30 seconds rather than 40 seconds.
82
832.2.6 / 12.10.2020
84==================
85
86* Changed `"twitter"` style: doesn't output `"now"` for 0 seconds.
87
88* Added `"twitter-now"` style that outputs `"now"` for 0 seconds.
89
902.2.5 / 11.10.2020
91==================
92
93* Added `addDefaultLocale()` static function (similar to `addLocale()` but also calls `setDefaultLocale()`).
94
95* `"twitter"` style used to output `"now"` for 0 seconds. Then it was changed to `"0s"`. Now it has been [changed](https://github.com/catamphetamine/javascript-time-ago/issues/38) to `"now"` again.
96
97* Added "CDN" section in the readme that documents using the library with `<script/>` tags (without a bundler).
98
992.2.0 / 09.10.2020
100==================
101
102* Renamed steps' `unit` to `formatAs`. The older name still works. Maybe it will be renamed to something else in some future.
103
104* Renamed steps' `threshold` to `minTime`. The older name still works but is considered deprecated.
105
106* Renamed steps' `threshold_for_idOrUnit: value` to `minTime: { id: value }`. The older way still works but is considered deprecated. Maybe `minTime: {}` object will be deprecated too in some future.
107
108* Added `test(date, { now, future })` function to steps: it can be an alternative to `minTime`. See "twitter" style for an example.
109
110* Added a third argument to steps' `format()` function: an object having shape `{ formatAs(unit, value): string, future: boolean }`.
111
112* Added `TimeAgo.addLabels(locale, name, labels)` function, that can be used to expand localized time labels.
113
114* Added `"twitter-first-minute"` style: same as `"twitter"` but doesn't output anything before the first minute. This is how `"twitter"` style worked initially.
115
116* Added `getTimeToNextUpdate` feature (see README).
117
118* Updated `relative-time-format` to the latest version: `0.1.x` -> `1.0.0`.
119
120* Locale files are now `*.json` files. There's no `quantify` function there now: now it's just labels. `{locale}/index.js` files are still there just for legacy compatibility.
121
122* Added the ability to use native [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat) and [`Intl.PluralRules`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/PluralRules) instead of the polyfills: in this case, pass `polyfill: false` option when creating a `TimeAgo` instance.
123
124* The bundle is now generated by Rollup rather than Webpack.
125
1262.1.5 / 07.10.2020
127==================
128
129* Custom styles: renamed `gradation` to `steps` and `flavour` to `labels`. The older names still work but are considered deprecated.
130
131* `factor` property of a "step" is now not required: if not present, it's assumed equal to the `unit` in seconds (for example, the default `factor` is `60 * 60` for `unit: "hour"`).
132
1332.1.4 / 06.10.2020
134==================
135
136* Renamed `"default"` style to `"round"`. The older name still works but is considered deprecated.
137
138* Added `"round-minute"` style: same as `"round"` but without seconds.
139
140* Renamed `"time"` style to `"approximate-time"`. The older name still works but is considered deprecated.
141
142* Renamed `"canonical"` gradation to `"round"`. The older name still works but is considered deprecated.
143
144* Renamed `"tiny"` time labels style to `"mini-time"`. `"tiny"` time labels style still works but is considered deprecated.
145
146* (internals) Renamed `tiny.json` locale files to `mini-time.json`. Removed `now` unit from `mini-time.json`.
147
148* (internals) `"approximate"` (previously `"convenient"`) style now uses `long` labels instead of `long-convenient.json`.
149
150* (internals) Removed `now` unit from `mini-time.json` files.
151
152* (internals) Removed `long-convenient.json` and `short-convenient.json` files: `long.json` and `short.json` in combination with `now.json` are used instead.
153
1542.1.0 / 05.10.2020
155==================
156
157* (could be considered a breaking change, but it doesn't actually break any apps) `"twitter"` style now outputs something like `"1s"` in case of `"1 second ago"`. Previously it didn't output anything when the time difference was less than a minute. The rationale for the change is that Twitter actually does output seconds when the time difference is less than a minute. There's still a small difference from Twitter: Twitter outputs `"now"` in case of `"0 seconds ago"` while this library outputs `"0s"` — the rationale is that "now" could be too long is different languages, and also it would look too contrasty compared to its "sibling" `"Xs"` time labels.
158
159* Added `"default"` style (`long` time labels + `canonical` gradation). Update: it's now called `"round"` instead of `"default"`.
160
161* Added `future` option on `.format(value, style, options)` function: it determines, whether to use the `"future"` variant of `"now"` when formatting `0` time difference. By default, it uses the `"past"` variant of `"now"` when formatting `0` time difference: `"just now"` instead of `"in a moment"`.
162
163* (miscellaneous) Added dedicated `"now.json"` labels for `"now"` time unit.
164
1652.0.10 / 16.07.2020
166==================
167
168* Added `"tiny"` time labels for `"de"` locale.
169
1702.0.0 / 14.01.2018
171==================
172
173 * Moved `RelativeTimeFormat` to a separate `relative-time-format` package.
174
175 * (breaking change) Removed `.locale()` static function. Use `.addLocale()` instead.
176
177 * (breaking change) `flavour` property renamed in non-single-word cases: underscores (`_`) got replaced with dashes (`-`). Examples: `short_convenient` -> `short-convenient`, `long_convenient` -> `long-convenient`, `short_time` -> `short-time`, `long_time` -> `long-time`. The relevant keys in locale `index.js` files got renamed the same way.
178
179 * (breaking change) `RelativeTimeFormat` is no longer exported from this library.
180
181 * (could be a breaking change) Re-did `/prop-types`, `/gradation`, `/cache` exports as sub-packages. This could possibly change their import behavior. Maybe `/prop-types` did change — I changed some export strategies for it.
182
183 * (unlikely a breaking change) `yue-Hant` locale removed (due to its removal from CLDR).
184
185 * (unlikely to be a breaking change) Removed handling for a case when "now" unit had "past"/"future" which is an object of quantifier messages instead of a string. The rationale that having "now" unit with "past"/"future" which are objects of quantifier messages wouldn't make sense because "now" is a moment and one can't differentiate between "past moment", "current moment" and "next moment" in real life.
186
1871.0.33 / 29.11.2018
188===================
189
190 * Resolved cyclic dependency between `JavascriptTimeAgo.js` and `RelativeTimeFormat.js`.
191
192 * `JavascriptTimeAgo.default_locale` variable no longer exists (it wasn't public or documented).
193
1941.0.32 / 04.11.2018
195===================
196
197 * Added `.addLocale()` alias for `.locale()` function (better naming). The old `.locale()` function name is now deprecated and will be removed in some next major version release.
198
199 * Added `RelativeTimeFormat.addLocale()` proxy function which simply calls `JavascriptTimeAgo.addLocale()`.
200
2011.0.19 / 12.01.2018
202===================
203
204 * Refactored `twitter` style and styles overall: style can now have `threshold(now)` function and also gradation step can have `format(value, locale)` function instead of `unit`.
205
2061.0.17 / 11.01.2018
207===================
208
209 * Renamed `override` to `custom` for styles
210
2111.0.15 / 11.01.2018
212===================
213
214 * Renamed `fuzzy` style to `time`.
215 * Refactored `gradation`s and `style`s.
216 * `gradation` is now not being exported from `index.js` along with `day`, `month` and `year` (one can still `import` it manually from `gradation.js`).
217 * `es6` folder got renamed to `modules`
218 * `build` folder got renamed to `commonjs`
219
2201.0.11 / 10.01.2018
221===================
222
223 * Renamed `plural` to `quantify` inside locale data.
224 * Implemented `Intl.RelativeTimeFormat` proposal polyfill which is now being exported.
225
2261.0.10 / 09.01.2018
227===================
228
229 * (can be a breaking change for custom styles) Renamed `just-now` unit to `now` and `xxx-concise` flavour to `xxx_time` (+ flavour `.json` files got renamed accordingly).
230
2311.0.8 / 09.01.2018
232===================
233
234 * (breaking change) When defining a custom `style` its `override()` function takes `date` and `time` parameters: now `date` parameter of `override()` is not guaranteed to be set (can be inferred from `time`).
235
2361.0.2 / 08.01.2018
237===================
238
239 * (breaking change) Due to a long-standing engineering flaw in `intl-messageformat` library (the locale data loading process) I dismissed it and this library is now using raw CLDR locale data instead so built-in locale data now holds an extra property: the `plural` function taking a number and returning the pluralization type of that number ("one", "few", etc). Therefore, if adding raw CLDR locale data for locales which are not built-in this pluralization function must be passed as the second argument to `.locale(localeDataCLDR, pluralsClassifier)`.
240
241 * (breaking change) `javascriptTimeAgo.styles` is no more accesible: pass `style` as a string instead.
242
243 * (breaking change) `locales` folder inside the package renamed to `locale` (e.g. `javascript-time-ago/locales/en` -> `javascript-time-ago/locale/en`).
244
245 * `style.flavour` can now be an array
246
2470.4.4 / 22.12.2016
248===================
249
250 * Changed `yesterday` and `tomorrow` labels for Russian localization
251
2520.2.0 / 13.04.2016
253===================
254
255 * Moved `intl-messageformat` to `peerDependencies`
256
2570.1.0 / 03.04.2016
258===================
259
260 * Initial release