Skip to content

Commit

Permalink
Merge pull request #303 from simonemazzoni/fix_humanize-duration-3.1.…
Browse files Browse the repository at this point in the history
…0-compatibility

FIX: humanizer units format according to humanize-duration v3.1.0+
  • Loading branch information
siddii authored Mar 9, 2017
2 parents a67196a + 57c60ea commit 8d10339
Show file tree
Hide file tree
Showing 12 changed files with 1,168 additions and 667 deletions.
19 changes: 10 additions & 9 deletions app/js/i18nService.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ app.factory('I18nService', function() {
this.language = this.fallback;
}

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

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

if (typeof this.timeHumanizer != 'undefined'){
time = {
'millis' : this.timeHumanizer(diffFromAlarm, { units: ["milliseconds"] }),
'seconds' : this.timeHumanizer(diffFromAlarm, { units: ["seconds"] }),
'minutes' : this.timeHumanizer(diffFromAlarm, { units: ["minutes", "seconds"] }) ,
'hours' : this.timeHumanizer(diffFromAlarm, { units: ["hours", "minutes", "seconds"] }) ,
'days' : this.timeHumanizer(diffFromAlarm, { units: ["days", "hours", "minutes", "seconds"] }) ,
'months' : this.timeHumanizer(diffFromAlarm, { units: ["months", "days", "hours", "minutes", "seconds"] }) ,
'years' : this.timeHumanizer(diffFromAlarm, { units: ["years", "months", "days", "hours", "minutes", "seconds"] })
'millis' : this.timeHumanizer(diffFromAlarm, { units: ["ms"] }),
'seconds' : this.timeHumanizer(diffFromAlarm, { units: ["s"] }),
'minutes' : this.timeHumanizer(diffFromAlarm, { units: ["m", "s"] }) ,
'hours' : this.timeHumanizer(diffFromAlarm, { units: ["h", "m", "s"] }) ,
'days' : this.timeHumanizer(diffFromAlarm, { units: ["d", "h", "m", "s"] }) ,
'months' : this.timeHumanizer(diffFromAlarm, { units: ["mo", "d", "h", "m", "s"] }) ,
'years' : this.timeHumanizer(diffFromAlarm, { units: ["y", "mo", "d", "h", "m", "s"] })
};
}
else {
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"angular": ">= 1.0.7",
"moment": "~2.9.0",
"humanize-duration": "~2.8.0"
"humanize-duration": "~3.10.0"
},
"devDependencies": {
"bootstrap": "2.3.2",
Expand Down
26 changes: 18 additions & 8 deletions bower_components/humanize-duration/.bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@
"name": "humanize-duration",
"authors": [
"Evan Hahn <[email protected]> (http://evanhahn.com)",
"Óli Tómas Freysson (https://github.com/olitomas)",
"Martin Prins (https://github.com/magarcia)",
"Filipi Siqueira (https://github.com/filipi777)",
"Peter Rekdal Sunde (https://github.com/peters)",
"Michał Janiec (https://github.com/mjjaniec)",
"Eileen Li (https://github.com/eileen3)",
"Tommy Brunn (https://github.com/Nevon)",
"Giovanni Pellerano (https://github.com/evilaliv3)",
"Rahma Sghaier (https://twitter.com/sghaierrahma)"
"Rahma Sghaier (https://twitter.com/sghaierrahma)",
"Evgenios Kastanias (https://github.com/evgenios)",
"Oleksii Mylotskyi (https://github.com/spalax)",
"Matthew Brandly (https://github.com/brandly)",
"Patrik Simek (https://github.com/patriksimek)",
"Toni Helminen (https://github.com/tonihelminen)",
"Vidmantas Drasutis (https://github.com/drasius2)",
"Manh Tuan (https://github.com/J2TeaM)",
"Leonard Lee (https://github.com/sheeeng)",
"Jesse Jackson (https://github.com/jsejcksn)"
],
"version": "2.8.0",
"version": "3.10.0",
"description": "Convert millisecond durations to English and many other languages.",
"main": "humanize-duration.js",
"homepage": "https://github.com/EvanHahn/HumanizeDuration.js",
Expand All @@ -26,7 +36,7 @@
"years",
"months"
],
"license": "WTFPL",
"license": "Unlicense",
"ignore": [
"**/.*",
"node_modules",
Expand All @@ -38,13 +48,13 @@
"type": "git",
"url": "git://github.com/EvanHahn/HumanizeDuration.js.git"
},
"_release": "2.8.0",
"_release": "3.10.0",
"_resolution": {
"type": "version",
"tag": "v2.8.0",
"commit": "dcab6eaf100968c008351c70ae3dea9a8a86d929"
"tag": "v3.10.0",
"commit": "18243414dc4ce75d93f6a501f0e88130f2126421"
},
"_source": "git://github.com/EvanHahn/HumanizeDuration.js.git",
"_target": "~2.8.0",
"_source": "https://github.com/EvanHahn/HumanizeDuration.js.git",
"_target": "~3.10.0",
"_originalSource": "humanize-duration"
}
6 changes: 3 additions & 3 deletions bower_components/humanize-duration/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ How to contribute

This assumes you have Node and npm installed.

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

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

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

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

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

0 comments on commit 8d10339

Please sign in to comment.