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.4.0 to 2.5.0

2

CONTRIBUTING.md

@@ -8,2 +8,4 @@ How to contribute

1. Make your changes. Please add tests! If adding a new language, define some tests in *test/definitions*.
1. If adding a new language, add it to the README.
1. Credit yourself in the README and in `package.json`.
1. Make sure `npm test` doesn't have any errors.

@@ -10,0 +12,0 @@ 1. Make sure `npm run hint` doesn't give any JSHint errors.

30

humanize-duration.js

@@ -20,5 +20,5 @@ // HumanizeDuration.js - http://git.io/j0HgmQ

month: function(c) { return "mes" + ((c !== 1) ? "os" : ""); },
week: function(c) { return "setman" + ((c !== 1) ? "es" :"a"); },
day: function(c) { return "di" + ((c !== 1) ? "es" :"a"); },
hour: function(c) { return "hor" + ((c !== 1) ? "es" :"a"); },
week: function(c) { return "setman" + ((c !== 1) ? "es" : "a"); },
day: function(c) { return "di" + ((c !== 1) ? "es" : "a"); },
hour: function(c) { return "hor" + ((c !== 1) ? "es" : "a"); },
minute: function(c) { return "minut" + ((c !== 1) ? "s" : ""); },

@@ -88,2 +88,12 @@ second: function(c) { return "segon" + ((c !== 1) ? "s" : ""); },

},
hu: {
year: "év",
month: "hónap",
week: "hét",
day: "nap",
hour: "óra",
minute: "perc",
second: "másodperc",
millisecond: "ezredmásodperc"
},
ja: {

@@ -195,4 +205,4 @@ year: "年",

var result = function humanizer(ms, passedOptions) {
var options = extend({}, result, passedOptions || {});
var result = function humanizer(ms, humanizerOptions) {
var options = extend({}, result, humanizerOptions || {});
return doHumanization(ms, options);

@@ -207,3 +217,4 @@ };

languages: {},
halfUnit: true
halfUnit: true,
round: false
}, passedOptions);

@@ -215,4 +226,4 @@

var defaultHumanizer = humanizer({});
function humanizeDuration(ms, passedOptions) {
return defaultHumanizer(ms, passedOptions);
function humanizeDuration() {
return defaultHumanizer.apply(defaultHumanizer, arguments);
}

@@ -259,2 +270,5 @@

unitCount = ms / unitMS;
if (options.round) {
unitCount = Math.round(unitCount);
}
} else {

@@ -261,0 +275,0 @@ unitCount = Math.floor(ms / unitMS);

@@ -11,3 +11,3 @@ {

],
"version": "2.4.0",
"version": "2.5.0",
"description": "Convert millisecond durations to English and many other languages.",

@@ -22,3 +22,3 @@ "homepage": "https://github.com/EvanHahn/HumanizeDuration.js",

"coffee-script": "^1.8.0",
"csv-parse": "0.0.6",
"csv-parse": "0.0.9",
"jshint": "^2.5.11",

@@ -48,3 +48,4 @@ "mocha": "^2.1.0",

"russian",
"turkish"
"turkish",
"hungarian"
],

@@ -51,0 +52,0 @@ "repository": {

@@ -12,3 +12,3 @@ Humanize Duration

This package is available as *humanize-duration* in Node and Bower. You can also include the JavaScript in the browser.
This package is available as *humanize-duration* in npm and Bower. You can also include the JavaScript in the browser.

@@ -54,10 +54,13 @@ In the browser:

humanizeDuration(3600000, { units: ["hours"] }) // 1 hour
humanizeDuration(3600000, { units: ["days", "hours"] }) // 1 hour
humanizeDuration(3600000, { units: ["minutes"] }) // 60 minutes
humanizeDuration(3600000, { units: ["hours"] }) // "1 hour"
humanizeDuration(3600000, { units: ["days", "hours"] }) // "1 hour"
humanizeDuration(3600000, { units: ["minutes"] }) // "60 minutes"
humanizeDuration(150000) // 2.5 minutes
humanizeDuration(150000, { halfUnit: false }) // 2 minutes, 30 seconds
```
humanizeDuration(1200) // "1.2 seconds"
humanizeDuration(1200, { round: true }) // "1 second"
humanizeDuration(1600, { round: true }) // "2 seconds"
humanizeDuration(150000) // "2.5 minutes"
humanizeDuration(150000, { halfUnit: false }) // "2 minutes, 30 seconds"
humanizeDuration(3600000, {

@@ -67,3 +70,3 @@ language: "es",

})
// 60 minutos
// "60 minutos"
```

@@ -131,2 +134,3 @@

* German (de)
* Hungarian (hu)
* Japanese (ja)

@@ -133,0 +137,0 @@ * Korean (ko)

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