Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

humanize-duration

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

humanize-duration - npm Package Compare versions

Comparing version 2.3.0 to 2.4.0

13

humanize-duration.js

@@ -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 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc