Skip to content

Commit 8d10339

Browse files
authored
Merge pull request siddii#303 from simonemazzoni/fix_humanize-duration-3.1.0-compatibility
FIX: humanizer units format according to humanize-duration v3.1.0+
2 parents a67196a + 57c60ea commit 8d10339

File tree

12 files changed

+1168
-667
lines changed

12 files changed

+1168
-667
lines changed

app/js/i18nService.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ app.factory('I18nService', function() {
2121
this.language = this.fallback;
2222
}
2323

24-
//moment init
25-
moment.locale(this.language); // @TODO maybe to remove, it should be handle by the user's application itself, and not inside the directive
24+
// It should be handle by the user's application itself, and not inside the directive
25+
// moment init
26+
// moment.locale(this.language);
2627

2728
//human duration init, using it because momentjs does not allow accurate time (
2829
// momentJS: a few moment ago, human duration : 4 seconds ago
@@ -44,13 +45,13 @@ app.factory('I18nService', function() {
4445

4546
if (typeof this.timeHumanizer != 'undefined'){
4647
time = {
47-
'millis' : this.timeHumanizer(diffFromAlarm, { units: ["milliseconds"] }),
48-
'seconds' : this.timeHumanizer(diffFromAlarm, { units: ["seconds"] }),
49-
'minutes' : this.timeHumanizer(diffFromAlarm, { units: ["minutes", "seconds"] }) ,
50-
'hours' : this.timeHumanizer(diffFromAlarm, { units: ["hours", "minutes", "seconds"] }) ,
51-
'days' : this.timeHumanizer(diffFromAlarm, { units: ["days", "hours", "minutes", "seconds"] }) ,
52-
'months' : this.timeHumanizer(diffFromAlarm, { units: ["months", "days", "hours", "minutes", "seconds"] }) ,
53-
'years' : this.timeHumanizer(diffFromAlarm, { units: ["years", "months", "days", "hours", "minutes", "seconds"] })
48+
'millis' : this.timeHumanizer(diffFromAlarm, { units: ["ms"] }),
49+
'seconds' : this.timeHumanizer(diffFromAlarm, { units: ["s"] }),
50+
'minutes' : this.timeHumanizer(diffFromAlarm, { units: ["m", "s"] }) ,
51+
'hours' : this.timeHumanizer(diffFromAlarm, { units: ["h", "m", "s"] }) ,
52+
'days' : this.timeHumanizer(diffFromAlarm, { units: ["d", "h", "m", "s"] }) ,
53+
'months' : this.timeHumanizer(diffFromAlarm, { units: ["mo", "d", "h", "m", "s"] }) ,
54+
'years' : this.timeHumanizer(diffFromAlarm, { units: ["y", "mo", "d", "h", "m", "s"] })
5455
};
5556
}
5657
else {

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"dependencies": {
1212
"angular": ">= 1.0.7",
1313
"moment": "~2.9.0",
14-
"humanize-duration": "~2.8.0"
14+
"humanize-duration": "~3.10.0"
1515
},
1616
"devDependencies": {
1717
"bootstrap": "2.3.2",

bower_components/humanize-duration/.bower.json

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,26 @@
22
"name": "humanize-duration",
33
"authors": [
44
"Evan Hahn <[email protected]> (http://evanhahn.com)",
5+
"Óli Tómas Freysson (https://github.com/olitomas)",
56
"Martin Prins (https://github.com/magarcia)",
67
"Filipi Siqueira (https://github.com/filipi777)",
78
"Peter Rekdal Sunde (https://github.com/peters)",
89
"Michał Janiec (https://github.com/mjjaniec)",
910
"Eileen Li (https://github.com/eileen3)",
1011
"Tommy Brunn (https://github.com/Nevon)",
1112
"Giovanni Pellerano (https://github.com/evilaliv3)",
12-
"Rahma Sghaier (https://twitter.com/sghaierrahma)"
13+
"Rahma Sghaier (https://twitter.com/sghaierrahma)",
14+
"Evgenios Kastanias (https://github.com/evgenios)",
15+
"Oleksii Mylotskyi (https://github.com/spalax)",
16+
"Matthew Brandly (https://github.com/brandly)",
17+
"Patrik Simek (https://github.com/patriksimek)",
18+
"Toni Helminen (https://github.com/tonihelminen)",
19+
"Vidmantas Drasutis (https://github.com/drasius2)",
20+
"Manh Tuan (https://github.com/J2TeaM)",
21+
"Leonard Lee (https://github.com/sheeeng)",
22+
"Jesse Jackson (https://github.com/jsejcksn)"
1323
],
14-
"version": "2.8.0",
24+
"version": "3.10.0",
1525
"description": "Convert millisecond durations to English and many other languages.",
1626
"main": "humanize-duration.js",
1727
"homepage": "https://github.com/EvanHahn/HumanizeDuration.js",
@@ -26,7 +36,7 @@
2636
"years",
2737
"months"
2838
],
29-
"license": "WTFPL",
39+
"license": "Unlicense",
3040
"ignore": [
3141
"**/.*",
3242
"node_modules",
@@ -38,13 +48,13 @@
3848
"type": "git",
3949
"url": "git://github.com/EvanHahn/HumanizeDuration.js.git"
4050
},
41-
"_release": "2.8.0",
51+
"_release": "3.10.0",
4252
"_resolution": {
4353
"type": "version",
44-
"tag": "v2.8.0",
45-
"commit": "dcab6eaf100968c008351c70ae3dea9a8a86d929"
54+
"tag": "v3.10.0",
55+
"commit": "18243414dc4ce75d93f6a501f0e88130f2126421"
4656
},
47-
"_source": "git://github.com/EvanHahn/HumanizeDuration.js.git",
48-
"_target": "~2.8.0",
57+
"_source": "https://github.com/EvanHahn/HumanizeDuration.js.git",
58+
"_target": "~3.10.0",
4959
"_originalSource": "humanize-duration"
5060
}

bower_components/humanize-duration/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ How to contribute
33

44
This assumes you have Node and npm installed.
55

6-
1. Fork the repo.
6+
1. Fork the repo on GitHub.
77
1. Clone the repo.
88
1. Run `npm install`.
9-
1. Make your changes. Please add tests! If adding a new language, define some tests in *test/definitions*.
9+
1. Make your changes. _Please add tests!_ If adding a new language, define some tests in *test/definitions*.
1010
1. Update `HISTORY.md` with your changes.
1111
1. If adding a new language, add it to the README.
12-
1. Credit yourself in the README and in `package.json`.
12+
1. Credit yourself in the README, in `package.json`, and in `bower.json`.
1313
1. Make sure `npm test` doesn't have any errors.
1414
1. Make sure `npm run hint` doesn't give any JSHint errors.
1515
1. Submit your pull request!
Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2-
Version 2, December 2004
1+
This is free and unencumbered software released into the public domain.
32

4-
Copyright (C) 2004 Sam Hocevar <[email protected]>
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
57

6-
Everyone is permitted to copy and distribute verbatim or modified
7-
copies of this license document, and changing it is allowed as long
8-
as the name is changed.
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
915

10-
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11-
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
1223

13-
0. You just DO WHAT THE FUCK YOU WANT TO.
24+
For more information, please refer to <http://unlicense.org/>

0 commit comments

Comments
 (0)