Skip to content

Commit

Permalink
Merge pull request #148 from gunn/patch-1
Browse files Browse the repository at this point in the history
Fix update period for dates older than a day
  • Loading branch information
nmn authored Dec 16, 2020
2 parents bf499d7 + 96979f8 commit d97f661
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,14 @@ export default function TimeAgo({
: seconds < HOUR
? 1000 * MINUTE
: seconds < DAY
? 1000 * HOUR
: 0
? 1000 * HOUR
: Infinity

const period = Math.min(
Math.max(unboundPeriod, minPeriod * 1000),
maxPeriod * 1000,
)

if (period) {
if (timeoutId) {
clearTimeout(timeoutId)
Expand Down

0 comments on commit d97f661

Please sign in to comment.