From b667ee4adf489e4604903965267d8b80d22e6119 Mon Sep 17 00:00:00 2001 From: Thomas Beverley Date: Wed, 26 May 2021 11:23:53 +0100 Subject: [PATCH 1/3] Fix refresh creating an infinite timeout loop --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index eade436..4a9b7e9 100644 --- a/src/index.js +++ b/src/index.js @@ -97,7 +97,7 @@ export default function TimeAgo({ maxPeriod * 1000, ) - if (period) { + if (period && period !== Infinity) { if (timeoutId) { clearTimeout(timeoutId) } From 181e3d9b10e1d86bbdff1717a0d9d04ca8809134 Mon Sep 17 00:00:00 2001 From: Thomas Beverley Date: Thu, 27 May 2021 08:43:35 +0100 Subject: [PATCH 2/3] Change maxPeriod option to a week rather than Infinity. Change the fallout timeout to a week rather than infinity --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 4a9b7e9..9ccfe19 100644 --- a/src/index.js +++ b/src/index.js @@ -63,7 +63,7 @@ export default function TimeAgo({ component = 'time', live = true, minPeriod = 0, - maxPeriod = Infinity, + maxPeriod = WEEK, title, now = () => Date.now(), ...passDownProps @@ -90,14 +90,14 @@ export default function TimeAgo({ ? 1000 * MINUTE : seconds < DAY ? 1000 * HOUR - : Infinity + : 1000 * WEEK const period = Math.min( Math.max(unboundPeriod, minPeriod * 1000), maxPeriod * 1000, ) - if (period && period !== Infinity) { + if (period) { if (timeoutId) { clearTimeout(timeoutId) } From adda69cfe5b2690feaf0822ba72dc3ec972c82e3 Mon Sep 17 00:00:00 2001 From: Naman Goel Date: Thu, 27 May 2021 18:43:49 -0700 Subject: [PATCH 3/3] Bump Version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9966221..a3acd4e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-timeago", - "version": "6.1.1", + "version": "6.2.0", "description": "A simple Time-Ago component for ReactJs", "main": "lib/index.js", "module": "es6/index.js",