humanize-duration
Advanced tools
Comparing version 0.8.2 to 0.9.0
@@ -101,2 +101,12 @@ /* | ||
millisecond: function(c) { return ["milisekunda", "milisekundy", "milisekundy", "milisekund"][getPolishForm(c)]; } | ||
}, | ||
da: { | ||
year: function() { return "år"; }, | ||
month: function(c) { return "måned" + ((c !== 1) ? "er" : ""); }, | ||
week: function(c) { return "uge" + ((c !== 1) ? "r" : ""); }, | ||
day: function(c) { return "dag" + ((c !== 1) ? "e" : ""); }, | ||
hour: function(c) { return "time" + ((c !== 1) ? "r" : ""); }, | ||
minute: function(c) { return "minut" + ((c !== 1) ? "ter" : ""); }, | ||
second: function(c) { return "sekund" + ((c !== 1) ? "er" : ""); }, | ||
millisecond: function(c) { return "millisekund" + ((c !== 1) ? "er" : ""); } | ||
} | ||
@@ -103,0 +113,0 @@ }; |
@@ -10,13 +10,15 @@ { | ||
], | ||
"version": "0.8.2", | ||
"version": "0.9.0", | ||
"description": "Convert millisecond durations to English or many other languages.", | ||
"main": "humanize-duration.js", | ||
"scripts": { | ||
"test": "./node_modules/mocha/bin/mocha" | ||
"test": "mocha && jshint humanize-duration.js", | ||
"hint": "jshint humanize-duration.js" | ||
}, | ||
"devDependencies": { | ||
"mocha": "1.19.x", | ||
"chai": "1.9.x", | ||
"sugar": "1.4.x", | ||
"coffee-script": "1.7.x" | ||
"coffee-script": "1.7.x", | ||
"jshint": "2.5.x", | ||
"mocha": "1.20.x", | ||
"sugar": "1.4.x" | ||
}, | ||
@@ -40,3 +42,4 @@ "keywords": [ | ||
"norwegian", | ||
"german" | ||
"german", | ||
"danish" | ||
], | ||
@@ -63,7 +66,3 @@ "jshintConfig": { | ||
"predef": [ | ||
"module", | ||
"require", | ||
"describe", | ||
"it", | ||
"beforeEach" | ||
"module" | ||
] | ||
@@ -75,3 +74,4 @@ }, | ||
}, | ||
"bugs": "https://github.com/EvanHahn/HumanizeDuration.js/issues", | ||
"license": "WTFPL" | ||
} |
Humanize Duration | ||
================= | ||
I have the time in milliseconds and I want it to become "30 minutes" or "3 days, 1 hour". | ||
I have the time in milliseconds and I want it to become "30 minutes" or "3 days, 1 hour". Enter Humanize Duration! | ||
Usage | ||
----- | ||
To use it in the browser: | ||
<script src="humanize-duration.js"></script> | ||
<script> | ||
humanizeDuration(12000); | ||
</script> | ||
To use in Node or Browserify (after installing [the package](https://npmjs.org/package/humanize-duration)): | ||
var humanizeDuration = require("humanize-duration"); | ||
humanizeDuration(12000); | ||
Here's some basic usage: | ||
humanizeDuration(1) // "1 millisecond" | ||
@@ -11,2 +28,4 @@ humanizeDuration(3000) // "3 seconds" | ||
You can also change the language: | ||
humanizeDuration(3000, "es") // "3 segundos" | ||
@@ -19,2 +38,4 @@ | ||
You can also get the components of the humanizization, using `componentsOf`: | ||
var components = humanizeDuration.componentsOf(97320000); | ||
@@ -28,17 +49,16 @@ // components.days == "1 day" | ||
In the browser: | ||
Some edge cases: | ||
<script src="humanize-duration.js"></script> | ||
<script> | ||
humanizeDuration(12000); | ||
</script> | ||
humanizeDuration(12.34) // "12.34 milliseconds" | ||
humanizeDuration(-567) // "567 milliseconds", ignores negative numbers | ||
In Node or Browserify (after installing [the package](https://npmjs.org/package/humanize-duration)): | ||
humanizeDuration(new Number(8910)) // works as normal | ||
var humanizeDuration = require("humanize-duration"); | ||
humanizeDuration(12000); | ||
Supported languages | ||
------------------- | ||
Supported languages: | ||
Humanize Duration supports the following languages: | ||
* Catalan (ca) | ||
* Danish (da) | ||
* English (en) | ||
@@ -53,4 +73,9 @@ * French (fr) | ||
Credits | ||
------- | ||
Lovingly made by [Evan Hahn](http://evanhahn.com/) with language support by [Martin Prins](https://github.com/magarcia). Thanks to [Filipi Siqueira](https://github.com/filipi777) for Portuguese support, [Peter Rekdal Sunde](https://github.com/peters) for Norwegian support, and [Michał Janiec](https://github.com/mjjaniec) for Polish support. | ||
Licensed under the WTFPL, so you can do whatever you want. | ||
Enjoy! |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
50377
17
215
78
5