humanize-duration
Advanced tools
Comparing version 2.3.0 to 2.4.0
@@ -186,3 +186,3 @@ // HumanizeDuration.js - http://git.io/j0HgmQ | ||
millisecond: "毫秒" | ||
}, | ||
} | ||
}; | ||
@@ -199,3 +199,3 @@ | ||
extend(result, { | ||
return extend(result, { | ||
language: "en", | ||
@@ -205,7 +205,6 @@ delimiter: ", ", | ||
units: ["year", "month", "week", "day", "hour", "minute", "second"], | ||
languages: {} | ||
languages: {}, | ||
halfUnit: true | ||
}, passedOptions); | ||
return result; | ||
} | ||
@@ -248,3 +247,3 @@ | ||
// If it's a half-unit interval, we're done. | ||
if (result.length === 0) { | ||
if (result.length === 0 && options.halfUnit) { | ||
mightBeHalfUnit = (ms / unitMS) * 2; | ||
@@ -323,3 +322,3 @@ if (mightBeHalfUnit === Math.floor(mightBeHalfUnit)) { | ||
return 2; | ||
} else if (c === 0 || (c >= 5 && c <= 20) || (c % 10 >= 5 && c % 10 <= 9) || (c % 10 === 0) ) { | ||
} else if (c === 0 || (c >= 5 && c <= 20) || (c % 10 >= 5 && c % 10 <= 9) || (c % 10 === 0)) { | ||
return 0; | ||
@@ -326,0 +325,0 @@ } else if (c === 1 || c % 10 === 1) { |
@@ -11,3 +11,3 @@ { | ||
], | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"description": "Convert millisecond durations to English and many other languages.", | ||
@@ -14,0 +14,0 @@ "homepage": "https://github.com/EvanHahn/HumanizeDuration.js", |
@@ -57,2 +57,6 @@ Humanize Duration | ||
humanizeDuration(150000) // 2.5 minutes | ||
humanizeDuration(150000, { halfUnit: false }) // 2 minutes, 30 seconds | ||
``` | ||
humanizeDuration(3600000, { | ||
@@ -86,10 +90,10 @@ language: "es", | ||
shortEn: { | ||
year: function(c) { return c + "y"; }, | ||
month: function(c) { return c + "mo"; }, | ||
week: function(c) { return c + "w"; }, | ||
day: function(c) { return c + "d"; }, | ||
hour: function(c) { return c + "h"; }, | ||
minute: function(c) { return c + "m"; }, | ||
second: function(c) { return c + "s"; }, | ||
millisecond: function(c) { return c + "ms"; }, | ||
year: function() { return "y"; }, | ||
month: function() { return "mo"; }, | ||
week: function() { return "w"; }, | ||
day: function() { return "d"; }, | ||
hour: function() { return "h"; }, | ||
minute: function() { return "m"; }, | ||
second: function() { return "s"; }, | ||
millisecond: function() { return "ms"; }, | ||
} | ||
@@ -96,0 +100,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19669
144