]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Remove s/ss global flag
authorIskren Chernev <iskren.chernev@gmail.com>
Sat, 11 Mar 2017 22:00:18 +0000 (00:00 +0200)
committerIskren Chernev <iskren.chernev@gmail.com>
Sat, 11 Mar 2017 22:00:18 +0000 (00:00 +0200)
src/lib/duration/humanize.js

index e28eeea4730fd212e6c90f0b471464374cd21c7f..454b01ae516b7d1b12eb40e5bc2a7c66a2c0a02e 100644 (file)
@@ -1,7 +1,6 @@
 import { createDuration } from './create';
 
 var round = Math.round;
-var secondsThresholdChanged = false;
 var thresholds = {
     ss: 44,         // a few seconds to seconds
     s : 45,         // seconds to minute
@@ -63,12 +62,10 @@ export function getSetRelativeTimeThreshold (threshold, limit) {
     if (limit === undefined) {
         return thresholds[threshold];
     }
-    if (threshold === 's' && !secondsThresholdChanged) {
+    thresholds[threshold] = limit;
+    if (threshold === 's') {
         thresholds.ss = limit - 1;
-    } else if (threshold === 'ss') {
-        secondsThresholdChanged = true;
     }
-    thresholds[threshold] = limit;
     return true;
 }