javascript-time-ago 2.5.12 → 2.6.1

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/README.md +462 -316
  3. package/bundle/javascript-time-ago.js +1 -1
  4. package/bundle/javascript-time-ago.js.map +1 -1
  5. package/bundle/javascript-time-ago.min.js +1 -1
  6. package/bundle/javascript-time-ago.min.js.map +1 -1
  7. package/commonjs/FullDateFormatter.js +72 -0
  8. package/commonjs/FullDateFormatter.js.map +1 -0
  9. package/commonjs/FullDateFormatter.test.js +26 -0
  10. package/commonjs/FullDateFormatter.test.js.map +1 -0
  11. package/commonjs/TimeAgo.js +208 -106
  12. package/commonjs/TimeAgo.js.map +1 -1
  13. package/commonjs/TimeAgo.test.js +95 -10
  14. package/commonjs/TimeAgo.test.js.map +1 -1
  15. package/commonjs/steps/getStepMinTime.js +26 -19
  16. package/commonjs/steps/getStepMinTime.js.map +1 -1
  17. package/commonjs/steps/getTimeToNextUpdate.js +10 -2
  18. package/commonjs/steps/getTimeToNextUpdate.js.map +1 -1
  19. package/commonjs/style/twitter.js +2 -3
  20. package/commonjs/style/twitter.js.map +1 -1
  21. package/commonjs/style/twitter.test.js +5 -2
  22. package/commonjs/style/twitter.test.js.map +1 -1
  23. package/full-date-formatter/index.cjs +4 -0
  24. package/full-date-formatter/index.cjs.js +9 -0
  25. package/full-date-formatter/index.d.ts +6 -0
  26. package/full-date-formatter/index.js +1 -0
  27. package/full-date-formatter/package.json +15 -0
  28. package/index.cjs +1 -1
  29. package/index.cjs.js +2 -2
  30. package/index.d.ts +14 -4
  31. package/index.js +3 -1
  32. package/modules/FullDateFormatter.js +67 -0
  33. package/modules/FullDateFormatter.js.map +1 -0
  34. package/modules/FullDateFormatter.test.js +22 -0
  35. package/modules/FullDateFormatter.test.js.map +1 -0
  36. package/modules/TimeAgo.js +208 -107
  37. package/modules/TimeAgo.js.map +1 -1
  38. package/modules/TimeAgo.test.js +95 -8
  39. package/modules/TimeAgo.test.js.map +1 -1
  40. package/modules/steps/getStepMinTime.js +26 -19
  41. package/modules/steps/getStepMinTime.js.map +1 -1
  42. package/modules/steps/getTimeToNextUpdate.js +10 -2
  43. package/modules/steps/getTimeToNextUpdate.js.map +1 -1
  44. package/modules/style/twitter.js +3 -3
  45. package/modules/style/twitter.js.map +1 -1
  46. package/modules/style/twitter.test.js +5 -2
  47. package/modules/style/twitter.test.js.map +1 -1
  48. package/package.json +16 -11
package/CHANGELOG.md CHANGED
@@ -33,6 +33,15 @@ TO DO: "time" style should use "round" scale instead of "approximate".
33
33
  TO 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
34
  -->
35
35
 
36
+ 2.6.0 / 28.09.2025
37
+ ==================
38
+
39
+ * Rewrote README.
40
+ * Added `refresh` parameter.
41
+ * `getTimeToNextUpdate: true` now returns a "capped" `timeToNextUpdate` by default — this is to work around `setTimeout()` [bug](https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values) when the delay is longer than about `24.85` days.
42
+ * The new "capping" behavior could be disabled by passing `getTimeToNextUpdateUncapped: true` option.
43
+ * Added `javascript-time-ago/full-date-formatter` export — it can be used to get the value for the `title` attribute of a `<time/>` HTML tag.
44
+
36
45
  2.4.0 / 19.05.2022
37
46
  ==================
38
47
 
@@ -117,7 +126,7 @@ TO DO: if `style` is passed as an object then maybe it should be passed as part
117
126
 
118
127
  * Added `test(date, { now, future })` function to steps: it can be an alternative to `minTime`. See "twitter" style for an example.
119
128
 
120
- * Added a third argument to steps' `format()` function: an object having shape `{ formatAs(unit, value): string, future: boolean }`.
129
+ * Added a third argument to steps' `format()` function: an object having shape `{ formatAs(unit, amount): string, future: boolean }`.
121
130
 
122
131
  * Added `TimeAgo.addLabels(locale, name, labels)` function, that can be used to expand localized time labels.
123
132