humanize-duration
Advanced tools
Comparing version 3.23.0 to 3.23.1
@@ -1,3 +0,2 @@ | ||
How to contribute | ||
================= | ||
# How to contribute | ||
@@ -11,3 +10,3 @@ **Note that this library is in maintenance mode. New languages and bug fixes will be added, but no new features. Please keep this in mind when making a pull request!** | ||
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. | ||
@@ -14,0 +13,0 @@ 1. If adding a new language, add it to the README. |
231
HISTORY.md
@@ -1,211 +0,180 @@ | ||
3.23.0 / 2020-05-21 | ||
=================== | ||
# 3.23.1 / 2020-06-11 | ||
* new: Swahili support | ||
- change: removed extra check when humanizing Arabic | ||
- change: simplify logic for Latvian | ||
3.22.0 / 2020-02-28 | ||
=================== | ||
# 3.23.0 / 2020-05-21 | ||
* new: Hebrew support | ||
- new: Swahili support | ||
3.21.0 / 2019-09-26 | ||
=================== | ||
# 3.22.0 / 2020-02-28 | ||
* new: Færøsk support | ||
- new: Hebrew support | ||
3.20.1 / 2019-07-28 | ||
=================== | ||
# 3.21.0 / 2019-09-26 | ||
* fix: if `decimal` is missing in a language, use `.` (see [#160](https://github.com/EvanHahn/HumanizeDuration.js/issues/160)) | ||
- new: Færøsk support | ||
3.20.0 / 2019-07-17 | ||
=================== | ||
# 3.20.1 / 2019-07-28 | ||
* new: Latvian support | ||
* fix: better handle properties that happen to also be on `Object.prototype` | ||
- fix: if `decimal` is missing in a language, use `.` (see [#160](https://github.com/EvanHahn/HumanizeDuration.js/issues/160)) | ||
3.19.0 / 2019-07-08 | ||
=================== | ||
# 3.20.0 / 2019-07-17 | ||
* new: Estonian support | ||
- new: Latvian support | ||
- fix: better handle properties that happen to also be on `Object.prototype` | ||
3.18.0 / 2019-03-07 | ||
=================== | ||
# 3.19.0 / 2019-07-08 | ||
* new: `maxDecimalPoints` option | ||
- new: Estonian support | ||
3.17.0 / 2019-01-06 | ||
=================== | ||
# 3.18.0 / 2019-03-07 | ||
* new: `fallback` option | ||
- new: `maxDecimalPoints` option | ||
3.16.0 / 2018-12-01 | ||
=================== | ||
# 3.17.0 / 2019-01-06 | ||
* new: Romanian support | ||
* new: Thai support | ||
- new: `fallbacks` option | ||
3.15.3 / 2018-09-18 | ||
=================== | ||
# 3.16.0 / 2018-12-01 | ||
* fix: Greek should be `el`, not `gr` | ||
- new: Romanian support | ||
- new: Thai support | ||
3.15.2 / 2018-09-12 | ||
=================== | ||
# 3.15.3 / 2018-09-18 | ||
* fix: corrections for Arabic | ||
- fix: Greek should be `el`, not `gr` | ||
3.15.1 / 2018-07-15 | ||
=================== | ||
# 3.15.2 / 2018-09-12 | ||
* fix: corrections for Croatian | ||
- fix: corrections for Arabic | ||
3.15.0 / 2018-06-12 | ||
=================== | ||
# 3.15.1 / 2018-07-15 | ||
* new: Croatian support | ||
* new: Lao support | ||
- fix: corrections for Croatian | ||
3.14.0 / 2018-03-23 | ||
=================== | ||
# 3.15.0 / 2018-06-12 | ||
* new: Urdu support | ||
- new: Croatian support | ||
- new: Lao support | ||
3.13.0 / 2018-03-19 | ||
=================== | ||
# 3.14.0 / 2018-03-23 | ||
* new: Slovak support | ||
- new: Urdu support | ||
3.12.1 / 2018-01-03 | ||
=================== | ||
# 3.13.0 / 2018-03-19 | ||
* fix: Ukranian translation for weeks was incorrect | ||
- new: Slovak support | ||
3.12.0 / 2017-11-07 | ||
=================== | ||
# 3.12.1 / 2018-01-03 | ||
* new: Bulgarian support | ||
- fix: Ukranian translation for weeks was incorrect | ||
3.11.0 / 2017-10-25 | ||
=================== | ||
# 3.12.0 / 2017-11-07 | ||
* new: Persian/Farsi support | ||
- new: Bulgarian support | ||
3.10.1 / 2017-07-21 | ||
=================== | ||
# 3.11.0 / 2017-10-25 | ||
* fix: use singular form from -2 to 2 in French | ||
- new: Persian/Farsi support | ||
3.10.0 / 2016-11-29 | ||
=================== | ||
# 3.10.1 / 2017-07-21 | ||
* new: Icelandic support | ||
- fix: use singular form from -2 to 2 in French | ||
3.9.1 / 2016-07-24 | ||
================== | ||
# 3.10.0 / 2016-11-29 | ||
* fix: Russian and Ukranian fixes | ||
- new: Icelandic support | ||
3.9.0 / 2016-06-10 | ||
================== | ||
# 3.9.1 / 2016-07-24 | ||
* new: Indonesian support | ||
* new: Malay support | ||
- fix: Russian and Ukranian fixes | ||
3.8.0 / 2016-05-19 | ||
================== | ||
# 3.9.0 / 2016-06-10 | ||
* new: `conjunctions` and `serialComma` options | ||
- new: Indonesian support | ||
- new: Malay support | ||
* update: improve documentation | ||
# 3.8.0 / 2016-05-19 | ||
3.7.1 / 2016-04-26 | ||
================== | ||
- new: `conjunctions` and `serialComma` options | ||
* fix: rounding had some more errors | ||
- update: improve documentation | ||
3.7.0 / 2016-03-18 | ||
================== | ||
# 3.7.1 / 2016-04-26 | ||
* new: Vietnamese support | ||
- fix: rounding had some more errors | ||
3.6.1 / 2016-02-19 | ||
================== | ||
# 3.7.0 / 2016-03-18 | ||
* update: readme should use single quotes | ||
- new: Vietnamese support | ||
* fix: rounding had some errors (for example, you could get "1 day, 24 hours") | ||
* fix: readme example was missing some quotes in its result | ||
# 3.6.1 / 2016-02-19 | ||
3.6.0 / 2016-02-12 | ||
================== | ||
- update: readme should use single quotes | ||
* new: Lithuanian support | ||
- fix: rounding had some errors (for example, you could get "1 day, 24 hours") | ||
- fix: readme example was missing some quotes in its result | ||
* fix: add trailing semicolon to improve concatenation with other libraries | ||
# 3.6.0 / 2016-02-12 | ||
3.5.0 / 2016-01-13 | ||
================== | ||
- new: Lithuanian support | ||
* new: Finnish support | ||
* new: recommend [millisec](https://github.com/sungwoncho/millisec) module in readme | ||
- fix: add trailing semicolon to improve concatenation with other libraries | ||
3.4.0 / 2015-12-11 | ||
================== | ||
# 3.5.0 / 2016-01-13 | ||
* new: Czech support | ||
- new: Finnish support | ||
- new: recommend [millisec](https://github.com/sungwoncho/millisec) module in readme | ||
* update: minor performance improvements | ||
* update: add "related modules" section to readme | ||
# 3.4.0 / 2015-12-11 | ||
* fix: add Greek to readme | ||
- new: Czech support | ||
3.3.0 / 2015-08-05 | ||
================== | ||
- update: minor performance improvements | ||
- update: add "related modules" section to readme | ||
* new: `unitMeasures` option | ||
- fix: add Greek to readme | ||
3.2.1 / 2015-07-22 | ||
================== | ||
# 3.3.0 / 2015-08-05 | ||
* fix: document `largest` option | ||
- new: `unitMeasures` option | ||
3.2.0 / 2015-07-15 | ||
================== | ||
# 3.2.1 / 2015-07-22 | ||
* new: Ukrainian support | ||
- fix: document `largest` option | ||
* fix: things would break in global strict mode | ||
# 3.2.0 / 2015-07-15 | ||
3.1.0 / 2015-06-25 | ||
================== | ||
- new: Ukrainian support | ||
* new: Greek support | ||
- fix: things would break in global strict mode | ||
3.0.0 / 2015-05-29 | ||
================== | ||
# 3.1.0 / 2015-06-25 | ||
* new: `largest` option to get largest units | ||
- new: Greek support | ||
* update: languages can change decimal point (which can be overridden) | ||
* update: fix some unintuitive `round` behavior | ||
* update: specify units in shorthand rather than longhand | ||
* update: use the Unlicense | ||
* update: `nob` is now `no` | ||
* update: use underscores instead of dashes for Chinese | ||
# 3.0.0 / 2015-05-29 | ||
* remove: half units | ||
- new: `largest` option to get largest units | ||
2.8.0 / 2015-05-10 | ||
================== | ||
- update: languages can change decimal point (which can be overridden) | ||
- update: fix some unintuitive `round` behavior | ||
- update: specify units in shorthand rather than longhand | ||
- update: use the Unlicense | ||
- update: `nob` is now `no` | ||
- update: use underscores instead of dashes for Chinese | ||
* new: `getSupportedLanguages` | ||
- remove: half units | ||
2.7.0 / 2015-05-08 | ||
================== | ||
# 2.8.0 / 2015-05-10 | ||
* new: changelog | ||
* new: Arabic support | ||
* new: Italian support | ||
- new: `getSupportedLanguages` | ||
* remove: (spoken) languages from package.json keywords | ||
# 2.7.0 / 2015-05-08 | ||
- new: changelog | ||
- new: Arabic support | ||
- new: Italian support | ||
- remove: (spoken) languages from package.json keywords |
// HumanizeDuration.js - https://git.io/j0HgmQ | ||
;(function () { | ||
/* global define, module */ | ||
(function () { | ||
// This has to be defined separately because of a bug: we want to alias | ||
@@ -9,171 +11,389 @@ // `gr` and `el` for backwards-compatiblity. In a breaking change, we can | ||
var greek = { | ||
y: function (c) { return c === 1 ? 'χρόνος' : 'χρόνια' }, | ||
mo: function (c) { return c === 1 ? 'μήνας' : 'μήνες' }, | ||
w: function (c) { return c === 1 ? 'εβδομάδα' : 'εβδομάδες' }, | ||
d: function (c) { return c === 1 ? 'μέρα' : 'μέρες' }, | ||
h: function (c) { return c === 1 ? 'ώρα' : 'ώρες' }, | ||
m: function (c) { return c === 1 ? 'λεπτό' : 'λεπτά' }, | ||
s: function (c) { return c === 1 ? 'δευτερόλεπτο' : 'δευτερόλεπτα' }, | ||
ms: function (c) { return c === 1 ? 'χιλιοστό του δευτερολέπτου' : 'χιλιοστά του δευτερολέπτου' }, | ||
decimal: ',' | ||
} | ||
y: function (c) { | ||
return c === 1 ? "χρόνος" : "χρόνια"; | ||
}, | ||
mo: function (c) { | ||
return c === 1 ? "μήνας" : "μήνες"; | ||
}, | ||
w: function (c) { | ||
return c === 1 ? "εβδομάδα" : "εβδομάδες"; | ||
}, | ||
d: function (c) { | ||
return c === 1 ? "μέρα" : "μέρες"; | ||
}, | ||
h: function (c) { | ||
return c === 1 ? "ώρα" : "ώρες"; | ||
}, | ||
m: function (c) { | ||
return c === 1 ? "λεπτό" : "λεπτά"; | ||
}, | ||
s: function (c) { | ||
return c === 1 ? "δευτερόλεπτο" : "δευτερόλεπτα"; | ||
}, | ||
ms: function (c) { | ||
return c === 1 | ||
? "χιλιοστό του δευτερολέπτου" | ||
: "χιλιοστά του δευτερολέπτου"; | ||
}, | ||
decimal: ",", | ||
}; | ||
var languages = { | ||
var LANGUAGES = { | ||
ar: { | ||
y: function (c) { return c === 1 ? 'سنة' : 'سنوات' }, | ||
mo: function (c) { return c === 1 ? 'شهر' : 'أشهر' }, | ||
w: function (c) { return c === 1 ? 'أسبوع' : 'أسابيع' }, | ||
d: function (c) { return c === 1 ? 'يوم' : 'أيام' }, | ||
h: function (c) { return c === 1 ? 'ساعة' : 'ساعات' }, | ||
y: function (c) { | ||
return c === 1 ? "سنة" : "سنوات"; | ||
}, | ||
mo: function (c) { | ||
return c === 1 ? "شهر" : "أشهر"; | ||
}, | ||
w: function (c) { | ||
return c === 1 ? "أسبوع" : "أسابيع"; | ||
}, | ||
d: function (c) { | ||
return c === 1 ? "يوم" : "أيام"; | ||
}, | ||
h: function (c) { | ||
return c === 1 ? "ساعة" : "ساعات"; | ||
}, | ||
m: function (c) { | ||
return ['دقيقة', 'دقائق'][getArabicForm(c)] | ||
return c > 2 && c < 11 ? "دقائق" : "دقيقة"; | ||
}, | ||
s: function (c) { return c === 1 ? 'ثانية' : 'ثواني' }, | ||
ms: function (c) { return c === 1 ? 'جزء من الثانية' : 'أجزاء من الثانية' }, | ||
decimal: ',' | ||
s: function (c) { | ||
return c === 1 ? "ثانية" : "ثواني"; | ||
}, | ||
ms: function (c) { | ||
return c === 1 ? "جزء من الثانية" : "أجزاء من الثانية"; | ||
}, | ||
decimal: ",", | ||
}, | ||
bg: { | ||
y: function (c) { return ['години', 'година', 'години'][getSlavicForm(c)] }, | ||
mo: function (c) { return ['месеца', 'месец', 'месеца'][getSlavicForm(c)] }, | ||
w: function (c) { return ['седмици', 'седмица', 'седмици'][getSlavicForm(c)] }, | ||
d: function (c) { return ['дни', 'ден', 'дни'][getSlavicForm(c)] }, | ||
h: function (c) { return ['часа', 'час', 'часа'][getSlavicForm(c)] }, | ||
m: function (c) { return ['минути', 'минута', 'минути'][getSlavicForm(c)] }, | ||
s: function (c) { return ['секунди', 'секунда', 'секунди'][getSlavicForm(c)] }, | ||
ms: function (c) { return ['милисекунди', 'милисекунда', 'милисекунди'][getSlavicForm(c)] }, | ||
decimal: ',' | ||
y: function (c) { | ||
return ["години", "година", "години"][getSlavicForm(c)]; | ||
}, | ||
mo: function (c) { | ||
return ["месеца", "месец", "месеца"][getSlavicForm(c)]; | ||
}, | ||
w: function (c) { | ||
return ["седмици", "седмица", "седмици"][getSlavicForm(c)]; | ||
}, | ||
d: function (c) { | ||
return ["дни", "ден", "дни"][getSlavicForm(c)]; | ||
}, | ||
h: function (c) { | ||
return ["часа", "час", "часа"][getSlavicForm(c)]; | ||
}, | ||
m: function (c) { | ||
return ["минути", "минута", "минути"][getSlavicForm(c)]; | ||
}, | ||
s: function (c) { | ||
return ["секунди", "секунда", "секунди"][getSlavicForm(c)]; | ||
}, | ||
ms: function (c) { | ||
return ["милисекунди", "милисекунда", "милисекунди"][getSlavicForm(c)]; | ||
}, | ||
decimal: ",", | ||
}, | ||
ca: { | ||
y: function (c) { return 'any' + (c === 1 ? '' : 's') }, | ||
mo: function (c) { return 'mes' + (c === 1 ? '' : 'os') }, | ||
w: function (c) { return 'setman' + (c === 1 ? 'a' : 'es') }, | ||
d: function (c) { return 'di' + (c === 1 ? 'a' : 'es') }, | ||
h: function (c) { return 'hor' + (c === 1 ? 'a' : 'es') }, | ||
m: function (c) { return 'minut' + (c === 1 ? '' : 's') }, | ||
s: function (c) { return 'segon' + (c === 1 ? '' : 's') }, | ||
ms: function (c) { return 'milisegon' + (c === 1 ? '' : 's') }, | ||
decimal: ',' | ||
y: function (c) { | ||
return "any" + (c === 1 ? "" : "s"); | ||
}, | ||
mo: function (c) { | ||
return "mes" + (c === 1 ? "" : "os"); | ||
}, | ||
w: function (c) { | ||
return "setman" + (c === 1 ? "a" : "es"); | ||
}, | ||
d: function (c) { | ||
return "di" + (c === 1 ? "a" : "es"); | ||
}, | ||
h: function (c) { | ||
return "hor" + (c === 1 ? "a" : "es"); | ||
}, | ||
m: function (c) { | ||
return "minut" + (c === 1 ? "" : "s"); | ||
}, | ||
s: function (c) { | ||
return "segon" + (c === 1 ? "" : "s"); | ||
}, | ||
ms: function (c) { | ||
return "milisegon" + (c === 1 ? "" : "s"); | ||
}, | ||
decimal: ",", | ||
}, | ||
cs: { | ||
y: function (c) { return ['rok', 'roku', 'roky', 'let'][getCzechOrSlovakForm(c)] }, | ||
mo: function (c) { return ['měsíc', 'měsíce', 'měsíce', 'měsíců'][getCzechOrSlovakForm(c)] }, | ||
w: function (c) { return ['týden', 'týdne', 'týdny', 'týdnů'][getCzechOrSlovakForm(c)] }, | ||
d: function (c) { return ['den', 'dne', 'dny', 'dní'][getCzechOrSlovakForm(c)] }, | ||
h: function (c) { return ['hodina', 'hodiny', 'hodiny', 'hodin'][getCzechOrSlovakForm(c)] }, | ||
m: function (c) { return ['minuta', 'minuty', 'minuty', 'minut'][getCzechOrSlovakForm(c)] }, | ||
s: function (c) { return ['sekunda', 'sekundy', 'sekundy', 'sekund'][getCzechOrSlovakForm(c)] }, | ||
ms: function (c) { return ['milisekunda', 'milisekundy', 'milisekundy', 'milisekund'][getCzechOrSlovakForm(c)] }, | ||
decimal: ',' | ||
y: function (c) { | ||
return ["rok", "roku", "roky", "let"][getCzechOrSlovakForm(c)]; | ||
}, | ||
mo: function (c) { | ||
return ["měsíc", "měsíce", "měsíce", "měsíců"][getCzechOrSlovakForm(c)]; | ||
}, | ||
w: function (c) { | ||
return ["týden", "týdne", "týdny", "týdnů"][getCzechOrSlovakForm(c)]; | ||
}, | ||
d: function (c) { | ||
return ["den", "dne", "dny", "dní"][getCzechOrSlovakForm(c)]; | ||
}, | ||
h: function (c) { | ||
return ["hodina", "hodiny", "hodiny", "hodin"][getCzechOrSlovakForm(c)]; | ||
}, | ||
m: function (c) { | ||
return ["minuta", "minuty", "minuty", "minut"][getCzechOrSlovakForm(c)]; | ||
}, | ||
s: function (c) { | ||
return ["sekunda", "sekundy", "sekundy", "sekund"][ | ||
getCzechOrSlovakForm(c) | ||
]; | ||
}, | ||
ms: function (c) { | ||
return ["milisekunda", "milisekundy", "milisekundy", "milisekund"][ | ||
getCzechOrSlovakForm(c) | ||
]; | ||
}, | ||
decimal: ",", | ||
}, | ||
da: { | ||
y: 'år', | ||
mo: function (c) { return 'måned' + (c === 1 ? '' : 'er') }, | ||
w: function (c) { return 'uge' + (c === 1 ? '' : 'r') }, | ||
d: function (c) { return 'dag' + (c === 1 ? '' : 'e') }, | ||
h: function (c) { return 'time' + (c === 1 ? '' : 'r') }, | ||
m: function (c) { return 'minut' + (c === 1 ? '' : 'ter') }, | ||
s: function (c) { return 'sekund' + (c === 1 ? '' : 'er') }, | ||
ms: function (c) { return 'millisekund' + (c === 1 ? '' : 'er') }, | ||
decimal: ',' | ||
y: "år", | ||
mo: function (c) { | ||
return "måned" + (c === 1 ? "" : "er"); | ||
}, | ||
w: function (c) { | ||
return "uge" + (c === 1 ? "" : "r"); | ||
}, | ||
d: function (c) { | ||
return "dag" + (c === 1 ? "" : "e"); | ||
}, | ||
h: function (c) { | ||
return "time" + (c === 1 ? "" : "r"); | ||
}, | ||
m: function (c) { | ||
return "minut" + (c === 1 ? "" : "ter"); | ||
}, | ||
s: function (c) { | ||
return "sekund" + (c === 1 ? "" : "er"); | ||
}, | ||
ms: function (c) { | ||
return "millisekund" + (c === 1 ? "" : "er"); | ||
}, | ||
decimal: ",", | ||
}, | ||
de: { | ||
y: function (c) { return 'Jahr' + (c === 1 ? '' : 'e') }, | ||
mo: function (c) { return 'Monat' + (c === 1 ? '' : 'e') }, | ||
w: function (c) { return 'Woche' + (c === 1 ? '' : 'n') }, | ||
d: function (c) { return 'Tag' + (c === 1 ? '' : 'e') }, | ||
h: function (c) { return 'Stunde' + (c === 1 ? '' : 'n') }, | ||
m: function (c) { return 'Minute' + (c === 1 ? '' : 'n') }, | ||
s: function (c) { return 'Sekunde' + (c === 1 ? '' : 'n') }, | ||
ms: function (c) { return 'Millisekunde' + (c === 1 ? '' : 'n') }, | ||
decimal: ',' | ||
y: function (c) { | ||
return "Jahr" + (c === 1 ? "" : "e"); | ||
}, | ||
mo: function (c) { | ||
return "Monat" + (c === 1 ? "" : "e"); | ||
}, | ||
w: function (c) { | ||
return "Woche" + (c === 1 ? "" : "n"); | ||
}, | ||
d: function (c) { | ||
return "Tag" + (c === 1 ? "" : "e"); | ||
}, | ||
h: function (c) { | ||
return "Stunde" + (c === 1 ? "" : "n"); | ||
}, | ||
m: function (c) { | ||
return "Minute" + (c === 1 ? "" : "n"); | ||
}, | ||
s: function (c) { | ||
return "Sekunde" + (c === 1 ? "" : "n"); | ||
}, | ||
ms: function (c) { | ||
return "Millisekunde" + (c === 1 ? "" : "n"); | ||
}, | ||
decimal: ",", | ||
}, | ||
el: greek, | ||
en: { | ||
y: function (c) { return 'year' + (c === 1 ? '' : 's') }, | ||
mo: function (c) { return 'month' + (c === 1 ? '' : 's') }, | ||
w: function (c) { return 'week' + (c === 1 ? '' : 's') }, | ||
d: function (c) { return 'day' + (c === 1 ? '' : 's') }, | ||
h: function (c) { return 'hour' + (c === 1 ? '' : 's') }, | ||
m: function (c) { return 'minute' + (c === 1 ? '' : 's') }, | ||
s: function (c) { return 'second' + (c === 1 ? '' : 's') }, | ||
ms: function (c) { return 'millisecond' + (c === 1 ? '' : 's') }, | ||
decimal: '.' | ||
y: function (c) { | ||
return "year" + (c === 1 ? "" : "s"); | ||
}, | ||
mo: function (c) { | ||
return "month" + (c === 1 ? "" : "s"); | ||
}, | ||
w: function (c) { | ||
return "week" + (c === 1 ? "" : "s"); | ||
}, | ||
d: function (c) { | ||
return "day" + (c === 1 ? "" : "s"); | ||
}, | ||
h: function (c) { | ||
return "hour" + (c === 1 ? "" : "s"); | ||
}, | ||
m: function (c) { | ||
return "minute" + (c === 1 ? "" : "s"); | ||
}, | ||
s: function (c) { | ||
return "second" + (c === 1 ? "" : "s"); | ||
}, | ||
ms: function (c) { | ||
return "millisecond" + (c === 1 ? "" : "s"); | ||
}, | ||
decimal: ".", | ||
}, | ||
es: { | ||
y: function (c) { return 'año' + (c === 1 ? '' : 's') }, | ||
mo: function (c) { return 'mes' + (c === 1 ? '' : 'es') }, | ||
w: function (c) { return 'semana' + (c === 1 ? '' : 's') }, | ||
d: function (c) { return 'día' + (c === 1 ? '' : 's') }, | ||
h: function (c) { return 'hora' + (c === 1 ? '' : 's') }, | ||
m: function (c) { return 'minuto' + (c === 1 ? '' : 's') }, | ||
s: function (c) { return 'segundo' + (c === 1 ? '' : 's') }, | ||
ms: function (c) { return 'milisegundo' + (c === 1 ? '' : 's') }, | ||
decimal: ',' | ||
y: function (c) { | ||
return "año" + (c === 1 ? "" : "s"); | ||
}, | ||
mo: function (c) { | ||
return "mes" + (c === 1 ? "" : "es"); | ||
}, | ||
w: function (c) { | ||
return "semana" + (c === 1 ? "" : "s"); | ||
}, | ||
d: function (c) { | ||
return "día" + (c === 1 ? "" : "s"); | ||
}, | ||
h: function (c) { | ||
return "hora" + (c === 1 ? "" : "s"); | ||
}, | ||
m: function (c) { | ||
return "minuto" + (c === 1 ? "" : "s"); | ||
}, | ||
s: function (c) { | ||
return "segundo" + (c === 1 ? "" : "s"); | ||
}, | ||
ms: function (c) { | ||
return "milisegundo" + (c === 1 ? "" : "s"); | ||
}, | ||
decimal: ",", | ||
}, | ||
et: { | ||
y: function (c) { return 'aasta' + (c === 1 ? '' : 't') }, | ||
mo: function (c) { return 'kuu' + (c === 1 ? '' : 'd') }, | ||
w: function (c) { return 'nädal' + (c === 1 ? '' : 'at') }, | ||
d: function (c) { return 'päev' + (c === 1 ? '' : 'a') }, | ||
h: function (c) { return 'tund' + (c === 1 ? '' : 'i') }, | ||
m: function (c) { return 'minut' + (c === 1 ? '' : 'it') }, | ||
s: function (c) { return 'sekund' + (c === 1 ? '' : 'it') }, | ||
ms: function (c) { return 'millisekund' + (c === 1 ? '' : 'it') }, | ||
decimal: ',' | ||
y: function (c) { | ||
return "aasta" + (c === 1 ? "" : "t"); | ||
}, | ||
mo: function (c) { | ||
return "kuu" + (c === 1 ? "" : "d"); | ||
}, | ||
w: function (c) { | ||
return "nädal" + (c === 1 ? "" : "at"); | ||
}, | ||
d: function (c) { | ||
return "päev" + (c === 1 ? "" : "a"); | ||
}, | ||
h: function (c) { | ||
return "tund" + (c === 1 ? "" : "i"); | ||
}, | ||
m: function (c) { | ||
return "minut" + (c === 1 ? "" : "it"); | ||
}, | ||
s: function (c) { | ||
return "sekund" + (c === 1 ? "" : "it"); | ||
}, | ||
ms: function (c) { | ||
return "millisekund" + (c === 1 ? "" : "it"); | ||
}, | ||
decimal: ",", | ||
}, | ||
fa: { | ||
y: 'سال', | ||
mo: 'ماه', | ||
w: 'هفته', | ||
d: 'روز', | ||
h: 'ساعت', | ||
m: 'دقیقه', | ||
s: 'ثانیه', | ||
ms: 'میلی ثانیه', | ||
decimal: '.' | ||
y: "سال", | ||
mo: "ماه", | ||
w: "هفته", | ||
d: "روز", | ||
h: "ساعت", | ||
m: "دقیقه", | ||
s: "ثانیه", | ||
ms: "میلی ثانیه", | ||
decimal: ".", | ||
}, | ||
fi: { | ||
y: function (c) { return c === 1 ? 'vuosi' : 'vuotta' }, | ||
mo: function (c) { return c === 1 ? 'kuukausi' : 'kuukautta' }, | ||
w: function (c) { return 'viikko' + (c === 1 ? '' : 'a') }, | ||
d: function (c) { return 'päivä' + (c === 1 ? '' : 'ä') }, | ||
h: function (c) { return 'tunti' + (c === 1 ? '' : 'a') }, | ||
m: function (c) { return 'minuutti' + (c === 1 ? '' : 'a') }, | ||
s: function (c) { return 'sekunti' + (c === 1 ? '' : 'a') }, | ||
ms: function (c) { return 'millisekunti' + (c === 1 ? '' : 'a') }, | ||
decimal: ',' | ||
y: function (c) { | ||
return c === 1 ? "vuosi" : "vuotta"; | ||
}, | ||
mo: function (c) { | ||
return c === 1 ? "kuukausi" : "kuukautta"; | ||
}, | ||
w: function (c) { | ||
return "viikko" + (c === 1 ? "" : "a"); | ||
}, | ||
d: function (c) { | ||
return "päivä" + (c === 1 ? "" : "ä"); | ||
}, | ||
h: function (c) { | ||
return "tunti" + (c === 1 ? "" : "a"); | ||
}, | ||
m: function (c) { | ||
return "minuutti" + (c === 1 ? "" : "a"); | ||
}, | ||
s: function (c) { | ||
return "sekunti" + (c === 1 ? "" : "a"); | ||
}, | ||
ms: function (c) { | ||
return "millisekunti" + (c === 1 ? "" : "a"); | ||
}, | ||
decimal: ",", | ||
}, | ||
fo: { | ||
y: 'ár', | ||
mo: function (c) { return c === 1 ? 'mánaður' : 'mánaðir' }, | ||
w: function (c) { return c === 1 ? 'vika' : 'vikur' }, | ||
d: function (c) { return c === 1 ? 'dagur' : 'dagar' }, | ||
h: function (c) { return c === 1 ? 'tími' : 'tímar' }, | ||
m: function (c) { return c === 1 ? 'minuttur' : 'minuttir' }, | ||
s: 'sekund', | ||
ms: 'millisekund', | ||
decimal: ',' | ||
y: "ár", | ||
mo: function (c) { | ||
return c === 1 ? "mánaður" : "mánaðir"; | ||
}, | ||
w: function (c) { | ||
return c === 1 ? "vika" : "vikur"; | ||
}, | ||
d: function (c) { | ||
return c === 1 ? "dagur" : "dagar"; | ||
}, | ||
h: function (c) { | ||
return c === 1 ? "tími" : "tímar"; | ||
}, | ||
m: function (c) { | ||
return c === 1 ? "minuttur" : "minuttir"; | ||
}, | ||
s: "sekund", | ||
ms: "millisekund", | ||
decimal: ",", | ||
}, | ||
fr: { | ||
y: function (c) { return 'an' + (c >= 2 ? 's' : '') }, | ||
mo: 'mois', | ||
w: function (c) { return 'semaine' + (c >= 2 ? 's' : '') }, | ||
d: function (c) { return 'jour' + (c >= 2 ? 's' : '') }, | ||
h: function (c) { return 'heure' + (c >= 2 ? 's' : '') }, | ||
m: function (c) { return 'minute' + (c >= 2 ? 's' : '') }, | ||
s: function (c) { return 'seconde' + (c >= 2 ? 's' : '') }, | ||
ms: function (c) { return 'milliseconde' + (c >= 2 ? 's' : '') }, | ||
decimal: ',' | ||
y: function (c) { | ||
return "an" + (c >= 2 ? "s" : ""); | ||
}, | ||
mo: "mois", | ||
w: function (c) { | ||
return "semaine" + (c >= 2 ? "s" : ""); | ||
}, | ||
d: function (c) { | ||
return "jour" + (c >= 2 ? "s" : ""); | ||
}, | ||
h: function (c) { | ||
return "heure" + (c >= 2 ? "s" : ""); | ||
}, | ||
m: function (c) { | ||
return "minute" + (c >= 2 ? "s" : ""); | ||
}, | ||
s: function (c) { | ||
return "seconde" + (c >= 2 ? "s" : ""); | ||
}, | ||
ms: function (c) { | ||
return "milliseconde" + (c >= 2 ? "s" : ""); | ||
}, | ||
decimal: ",", | ||
}, | ||
gr: greek, | ||
he: { | ||
y: function (c) { return c === 1 ? 'שנה' : 'שנים' }, | ||
mo: function (c) { return c === 1 ? 'חודש' : 'חודשים' }, | ||
w: function (c) { return c === 1 ? 'שבוע' : 'שבועות' }, | ||
d: function (c) { return c === 1 ? 'יום' : 'ימים' }, | ||
h: function (c) { return c === 1 ? 'שעה' : 'שעות' }, | ||
m: function (c) { return c === 1 ? 'דקה' : 'דקות' }, | ||
s: function (c) { return c === 1 ? 'שניה' : 'שניות' }, | ||
ms: function (c) { return c === 1 ? 'מילישנייה' : 'מילישניות' }, | ||
decimal: '.' | ||
y: function (c) { | ||
return c === 1 ? "שנה" : "שנים"; | ||
}, | ||
mo: function (c) { | ||
return c === 1 ? "חודש" : "חודשים"; | ||
}, | ||
w: function (c) { | ||
return c === 1 ? "שבוע" : "שבועות"; | ||
}, | ||
d: function (c) { | ||
return c === 1 ? "יום" : "ימים"; | ||
}, | ||
h: function (c) { | ||
return c === 1 ? "שעה" : "שעות"; | ||
}, | ||
m: function (c) { | ||
return c === 1 ? "דקה" : "דקות"; | ||
}, | ||
s: function (c) { | ||
return c === 1 ? "שניה" : "שניות"; | ||
}, | ||
ms: function (c) { | ||
return c === 1 ? "מילישנייה" : "מילישניות"; | ||
}, | ||
decimal: ".", | ||
}, | ||
@@ -183,386 +403,633 @@ hr: { | ||
if (c % 10 === 2 || c % 10 === 3 || c % 10 === 4) { | ||
return 'godine' | ||
return "godine"; | ||
} | ||
return 'godina' | ||
return "godina"; | ||
}, | ||
mo: function (c) { | ||
if (c === 1) { | ||
return 'mjesec' | ||
return "mjesec"; | ||
} else if (c === 2 || c === 3 || c === 4) { | ||
return 'mjeseca' | ||
return "mjeseca"; | ||
} | ||
return 'mjeseci' | ||
return "mjeseci"; | ||
}, | ||
w: function (c) { | ||
if (c % 10 === 1 && c !== 11) { | ||
return 'tjedan' | ||
return "tjedan"; | ||
} | ||
return 'tjedna' | ||
return "tjedna"; | ||
}, | ||
d: function (c) { return c === 1 ? 'dan' : 'dana' }, | ||
d: function (c) { | ||
return c === 1 ? "dan" : "dana"; | ||
}, | ||
h: function (c) { | ||
if (c === 1) { | ||
return 'sat' | ||
return "sat"; | ||
} else if (c === 2 || c === 3 || c === 4) { | ||
return 'sata' | ||
return "sata"; | ||
} | ||
return 'sati' | ||
return "sati"; | ||
}, | ||
m: function (c) { | ||
var mod10 = c % 10 | ||
var mod10 = c % 10; | ||
if ((mod10 === 2 || mod10 === 3 || mod10 === 4) && (c < 10 || c > 14)) { | ||
return 'minute' | ||
return "minute"; | ||
} | ||
return 'minuta' | ||
return "minuta"; | ||
}, | ||
s: function (c) { | ||
if ((c === 10 || c === 11 || c === 12 || c === 13 || c === 14 || c === 16 || c === 17 || c === 18 || c === 19) || (c % 10 === 5)) { | ||
return 'sekundi' | ||
if ( | ||
c === 10 || | ||
c === 11 || | ||
c === 12 || | ||
c === 13 || | ||
c === 14 || | ||
c === 16 || | ||
c === 17 || | ||
c === 18 || | ||
c === 19 || | ||
c % 10 === 5 | ||
) { | ||
return "sekundi"; | ||
} else if (c % 10 === 1) { | ||
return 'sekunda' | ||
return "sekunda"; | ||
} else if (c % 10 === 2 || c % 10 === 3 || c % 10 === 4) { | ||
return 'sekunde' | ||
return "sekunde"; | ||
} | ||
return 'sekundi' | ||
return "sekundi"; | ||
}, | ||
ms: function (c) { | ||
if (c === 1) { | ||
return 'milisekunda' | ||
return "milisekunda"; | ||
} else if (c % 10 === 2 || c % 10 === 3 || c % 10 === 4) { | ||
return 'milisekunde' | ||
return "milisekunde"; | ||
} | ||
return 'milisekundi' | ||
return "milisekundi"; | ||
}, | ||
decimal: ',' | ||
decimal: ",", | ||
}, | ||
hu: { | ||
y: 'év', | ||
mo: 'hónap', | ||
w: 'hét', | ||
d: 'nap', | ||
h: 'óra', | ||
m: 'perc', | ||
s: 'másodperc', | ||
ms: 'ezredmásodperc', | ||
decimal: ',' | ||
y: "év", | ||
mo: "hónap", | ||
w: "hét", | ||
d: "nap", | ||
h: "óra", | ||
m: "perc", | ||
s: "másodperc", | ||
ms: "ezredmásodperc", | ||
decimal: ",", | ||
}, | ||
id: { | ||
y: 'tahun', | ||
mo: 'bulan', | ||
w: 'minggu', | ||
d: 'hari', | ||
h: 'jam', | ||
m: 'menit', | ||
s: 'detik', | ||
ms: 'milidetik', | ||
decimal: '.' | ||
y: "tahun", | ||
mo: "bulan", | ||
w: "minggu", | ||
d: "hari", | ||
h: "jam", | ||
m: "menit", | ||
s: "detik", | ||
ms: "milidetik", | ||
decimal: ".", | ||
}, | ||
is: { | ||
y: 'ár', | ||
mo: function (c) { return 'mánuð' + (c === 1 ? 'ur' : 'ir') }, | ||
w: function (c) { return 'vik' + (c === 1 ? 'a' : 'ur') }, | ||
d: function (c) { return 'dag' + (c === 1 ? 'ur' : 'ar') }, | ||
h: function (c) { return 'klukkutím' + (c === 1 ? 'i' : 'ar') }, | ||
m: function (c) { return 'mínút' + (c === 1 ? 'a' : 'ur') }, | ||
s: function (c) { return 'sekúnd' + (c === 1 ? 'a' : 'ur') }, | ||
ms: function (c) { return 'millisekúnd' + (c === 1 ? 'a' : 'ur') }, | ||
decimal: '.' | ||
y: "ár", | ||
mo: function (c) { | ||
return "mánuð" + (c === 1 ? "ur" : "ir"); | ||
}, | ||
w: function (c) { | ||
return "vik" + (c === 1 ? "a" : "ur"); | ||
}, | ||
d: function (c) { | ||
return "dag" + (c === 1 ? "ur" : "ar"); | ||
}, | ||
h: function (c) { | ||
return "klukkutím" + (c === 1 ? "i" : "ar"); | ||
}, | ||
m: function (c) { | ||
return "mínút" + (c === 1 ? "a" : "ur"); | ||
}, | ||
s: function (c) { | ||
return "sekúnd" + (c === 1 ? "a" : "ur"); | ||
}, | ||
ms: function (c) { | ||
return "millisekúnd" + (c === 1 ? "a" : "ur"); | ||
}, | ||
decimal: ".", | ||
}, | ||
it: { | ||
y: function (c) { return 'ann' + (c === 1 ? 'o' : 'i') }, | ||
mo: function (c) { return 'mes' + (c === 1 ? 'e' : 'i') }, | ||
w: function (c) { return 'settiman' + (c === 1 ? 'a' : 'e') }, | ||
d: function (c) { return 'giorn' + (c === 1 ? 'o' : 'i') }, | ||
h: function (c) { return 'or' + (c === 1 ? 'a' : 'e') }, | ||
m: function (c) { return 'minut' + (c === 1 ? 'o' : 'i') }, | ||
s: function (c) { return 'second' + (c === 1 ? 'o' : 'i') }, | ||
ms: function (c) { return 'millisecond' + (c === 1 ? 'o' : 'i') }, | ||
decimal: ',' | ||
y: function (c) { | ||
return "ann" + (c === 1 ? "o" : "i"); | ||
}, | ||
mo: function (c) { | ||
return "mes" + (c === 1 ? "e" : "i"); | ||
}, | ||
w: function (c) { | ||
return "settiman" + (c === 1 ? "a" : "e"); | ||
}, | ||
d: function (c) { | ||
return "giorn" + (c === 1 ? "o" : "i"); | ||
}, | ||
h: function (c) { | ||
return "or" + (c === 1 ? "a" : "e"); | ||
}, | ||
m: function (c) { | ||
return "minut" + (c === 1 ? "o" : "i"); | ||
}, | ||
s: function (c) { | ||
return "second" + (c === 1 ? "o" : "i"); | ||
}, | ||
ms: function (c) { | ||
return "millisecond" + (c === 1 ? "o" : "i"); | ||
}, | ||
decimal: ",", | ||
}, | ||
ja: { | ||
y: '年', | ||
mo: '月', | ||
w: '週', | ||
d: '日', | ||
h: '時間', | ||
m: '分', | ||
s: '秒', | ||
ms: 'ミリ秒', | ||
decimal: '.' | ||
y: "年", | ||
mo: "月", | ||
w: "週", | ||
d: "日", | ||
h: "時間", | ||
m: "分", | ||
s: "秒", | ||
ms: "ミリ秒", | ||
decimal: ".", | ||
}, | ||
ko: { | ||
y: '년', | ||
mo: '개월', | ||
w: '주일', | ||
d: '일', | ||
h: '시간', | ||
m: '분', | ||
s: '초', | ||
ms: '밀리 초', | ||
decimal: '.' | ||
y: "년", | ||
mo: "개월", | ||
w: "주일", | ||
d: "일", | ||
h: "시간", | ||
m: "분", | ||
s: "초", | ||
ms: "밀리 초", | ||
decimal: ".", | ||
}, | ||
lo: { | ||
y: 'ປີ', | ||
mo: 'ເດືອນ', | ||
w: 'ອາທິດ', | ||
d: 'ມື້', | ||
h: 'ຊົ່ວໂມງ', | ||
m: 'ນາທີ', | ||
s: 'ວິນາທີ', | ||
ms: 'ມິນລິວິນາທີ', | ||
decimal: ',' | ||
y: "ປີ", | ||
mo: "ເດືອນ", | ||
w: "ອາທິດ", | ||
d: "ມື້", | ||
h: "ຊົ່ວໂມງ", | ||
m: "ນາທີ", | ||
s: "ວິນາທີ", | ||
ms: "ມິນລິວິນາທີ", | ||
decimal: ",", | ||
}, | ||
lt: { | ||
y: function (c) { return ((c % 10 === 0) || (c % 100 >= 10 && c % 100 <= 20)) ? 'metų' : 'metai' }, | ||
mo: function (c) { return ['mėnuo', 'mėnesiai', 'mėnesių'][getLithuanianForm(c)] }, | ||
w: function (c) { return ['savaitė', 'savaitės', 'savaičių'][getLithuanianForm(c)] }, | ||
d: function (c) { return ['diena', 'dienos', 'dienų'][getLithuanianForm(c)] }, | ||
h: function (c) { return ['valanda', 'valandos', 'valandų'][getLithuanianForm(c)] }, | ||
m: function (c) { return ['minutė', 'minutės', 'minučių'][getLithuanianForm(c)] }, | ||
s: function (c) { return ['sekundė', 'sekundės', 'sekundžių'][getLithuanianForm(c)] }, | ||
ms: function (c) { return ['milisekundė', 'milisekundės', 'milisekundžių'][getLithuanianForm(c)] }, | ||
decimal: ',' | ||
y: function (c) { | ||
return c % 10 === 0 || (c % 100 >= 10 && c % 100 <= 20) | ||
? "metų" | ||
: "metai"; | ||
}, | ||
mo: function (c) { | ||
return ["mėnuo", "mėnesiai", "mėnesių"][getLithuanianForm(c)]; | ||
}, | ||
w: function (c) { | ||
return ["savaitė", "savaitės", "savaičių"][getLithuanianForm(c)]; | ||
}, | ||
d: function (c) { | ||
return ["diena", "dienos", "dienų"][getLithuanianForm(c)]; | ||
}, | ||
h: function (c) { | ||
return ["valanda", "valandos", "valandų"][getLithuanianForm(c)]; | ||
}, | ||
m: function (c) { | ||
return ["minutė", "minutės", "minučių"][getLithuanianForm(c)]; | ||
}, | ||
s: function (c) { | ||
return ["sekundė", "sekundės", "sekundžių"][getLithuanianForm(c)]; | ||
}, | ||
ms: function (c) { | ||
return ["milisekundė", "milisekundės", "milisekundžių"][ | ||
getLithuanianForm(c) | ||
]; | ||
}, | ||
decimal: ",", | ||
}, | ||
lv: { | ||
y: function (c) { return ['gads', 'gadi'][getLatvianForm(c)] }, | ||
mo: function (c) { return ['mēnesis', 'mēneši'][getLatvianForm(c)] }, | ||
w: function (c) { return ['nedēļa', 'nedēļas'][getLatvianForm(c)] }, | ||
d: function (c) { return ['diena', 'dienas'][getLatvianForm(c)] }, | ||
h: function (c) { return ['stunda', 'stundas'][getLatvianForm(c)] }, | ||
m: function (c) { return ['minūte', 'minūtes'][getLatvianForm(c)] }, | ||
s: function (c) { return ['sekunde', 'sekundes'][getLatvianForm(c)] }, | ||
ms: function (c) { return ['milisekunde', 'milisekundes'][getLatvianForm(c)] }, | ||
decimal: ',' | ||
y: function (c) { | ||
return getLatvianForm(c) ? "gads" : "gadi"; | ||
}, | ||
mo: function (c) { | ||
return getLatvianForm(c) ? "mēnesis" : "mēneši"; | ||
}, | ||
w: function (c) { | ||
return getLatvianForm(c) ? "nedēļa" : "nedēļas"; | ||
}, | ||
d: function (c) { | ||
return getLatvianForm(c) ? "diena" : "dienas"; | ||
}, | ||
h: function (c) { | ||
return getLatvianForm(c) ? "stunda" : "stundas"; | ||
}, | ||
m: function (c) { | ||
return getLatvianForm(c) ? "minūte" : "minūtes"; | ||
}, | ||
s: function (c) { | ||
return getLatvianForm(c) ? "sekunde" : "sekundes"; | ||
}, | ||
ms: function (c) { | ||
return getLatvianForm(c) ? "milisekunde" : "milisekundes"; | ||
}, | ||
decimal: ",", | ||
}, | ||
ms: { | ||
y: 'tahun', | ||
mo: 'bulan', | ||
w: 'minggu', | ||
d: 'hari', | ||
h: 'jam', | ||
m: 'minit', | ||
s: 'saat', | ||
ms: 'milisaat', | ||
decimal: '.' | ||
y: "tahun", | ||
mo: "bulan", | ||
w: "minggu", | ||
d: "hari", | ||
h: "jam", | ||
m: "minit", | ||
s: "saat", | ||
ms: "milisaat", | ||
decimal: ".", | ||
}, | ||
nl: { | ||
y: 'jaar', | ||
mo: function (c) { return c === 1 ? 'maand' : 'maanden' }, | ||
w: function (c) { return c === 1 ? 'week' : 'weken' }, | ||
d: function (c) { return c === 1 ? 'dag' : 'dagen' }, | ||
h: 'uur', | ||
m: function (c) { return c === 1 ? 'minuut' : 'minuten' }, | ||
s: function (c) { return c === 1 ? 'seconde' : 'seconden' }, | ||
ms: function (c) { return c === 1 ? 'milliseconde' : 'milliseconden' }, | ||
decimal: ',' | ||
y: "jaar", | ||
mo: function (c) { | ||
return c === 1 ? "maand" : "maanden"; | ||
}, | ||
w: function (c) { | ||
return c === 1 ? "week" : "weken"; | ||
}, | ||
d: function (c) { | ||
return c === 1 ? "dag" : "dagen"; | ||
}, | ||
h: "uur", | ||
m: function (c) { | ||
return c === 1 ? "minuut" : "minuten"; | ||
}, | ||
s: function (c) { | ||
return c === 1 ? "seconde" : "seconden"; | ||
}, | ||
ms: function (c) { | ||
return c === 1 ? "milliseconde" : "milliseconden"; | ||
}, | ||
decimal: ",", | ||
}, | ||
no: { | ||
y: 'år', | ||
mo: function (c) { return 'måned' + (c === 1 ? '' : 'er') }, | ||
w: function (c) { return 'uke' + (c === 1 ? '' : 'r') }, | ||
d: function (c) { return 'dag' + (c === 1 ? '' : 'er') }, | ||
h: function (c) { return 'time' + (c === 1 ? '' : 'r') }, | ||
m: function (c) { return 'minutt' + (c === 1 ? '' : 'er') }, | ||
s: function (c) { return 'sekund' + (c === 1 ? '' : 'er') }, | ||
ms: function (c) { return 'millisekund' + (c === 1 ? '' : 'er') }, | ||
decimal: ',' | ||
y: "år", | ||
mo: function (c) { | ||
return "måned" + (c === 1 ? "" : "er"); | ||
}, | ||
w: function (c) { | ||
return "uke" + (c === 1 ? "" : "r"); | ||
}, | ||
d: function (c) { | ||
return "dag" + (c === 1 ? "" : "er"); | ||
}, | ||
h: function (c) { | ||
return "time" + (c === 1 ? "" : "r"); | ||
}, | ||
m: function (c) { | ||
return "minutt" + (c === 1 ? "" : "er"); | ||
}, | ||
s: function (c) { | ||
return "sekund" + (c === 1 ? "" : "er"); | ||
}, | ||
ms: function (c) { | ||
return "millisekund" + (c === 1 ? "" : "er"); | ||
}, | ||
decimal: ",", | ||
}, | ||
pl: { | ||
y: function (c) { return ['rok', 'roku', 'lata', 'lat'][getPolishForm(c)] }, | ||
mo: function (c) { return ['miesiąc', 'miesiąca', 'miesiące', 'miesięcy'][getPolishForm(c)] }, | ||
w: function (c) { return ['tydzień', 'tygodnia', 'tygodnie', 'tygodni'][getPolishForm(c)] }, | ||
d: function (c) { return ['dzień', 'dnia', 'dni', 'dni'][getPolishForm(c)] }, | ||
h: function (c) { return ['godzina', 'godziny', 'godziny', 'godzin'][getPolishForm(c)] }, | ||
m: function (c) { return ['minuta', 'minuty', 'minuty', 'minut'][getPolishForm(c)] }, | ||
s: function (c) { return ['sekunda', 'sekundy', 'sekundy', 'sekund'][getPolishForm(c)] }, | ||
ms: function (c) { return ['milisekunda', 'milisekundy', 'milisekundy', 'milisekund'][getPolishForm(c)] }, | ||
decimal: ',' | ||
y: function (c) { | ||
return ["rok", "roku", "lata", "lat"][getPolishForm(c)]; | ||
}, | ||
mo: function (c) { | ||
return ["miesiąc", "miesiąca", "miesiące", "miesięcy"][ | ||
getPolishForm(c) | ||
]; | ||
}, | ||
w: function (c) { | ||
return ["tydzień", "tygodnia", "tygodnie", "tygodni"][getPolishForm(c)]; | ||
}, | ||
d: function (c) { | ||
return ["dzień", "dnia", "dni", "dni"][getPolishForm(c)]; | ||
}, | ||
h: function (c) { | ||
return ["godzina", "godziny", "godziny", "godzin"][getPolishForm(c)]; | ||
}, | ||
m: function (c) { | ||
return ["minuta", "minuty", "minuty", "minut"][getPolishForm(c)]; | ||
}, | ||
s: function (c) { | ||
return ["sekunda", "sekundy", "sekundy", "sekund"][getPolishForm(c)]; | ||
}, | ||
ms: function (c) { | ||
return ["milisekunda", "milisekundy", "milisekundy", "milisekund"][ | ||
getPolishForm(c) | ||
]; | ||
}, | ||
decimal: ",", | ||
}, | ||
pt: { | ||
y: function (c) { return 'ano' + (c === 1 ? '' : 's') }, | ||
mo: function (c) { return c === 1 ? 'mês' : 'meses' }, | ||
w: function (c) { return 'semana' + (c === 1 ? '' : 's') }, | ||
d: function (c) { return 'dia' + (c === 1 ? '' : 's') }, | ||
h: function (c) { return 'hora' + (c === 1 ? '' : 's') }, | ||
m: function (c) { return 'minuto' + (c === 1 ? '' : 's') }, | ||
s: function (c) { return 'segundo' + (c === 1 ? '' : 's') }, | ||
ms: function (c) { return 'milissegundo' + (c === 1 ? '' : 's') }, | ||
decimal: ',' | ||
y: function (c) { | ||
return "ano" + (c === 1 ? "" : "s"); | ||
}, | ||
mo: function (c) { | ||
return c === 1 ? "mês" : "meses"; | ||
}, | ||
w: function (c) { | ||
return "semana" + (c === 1 ? "" : "s"); | ||
}, | ||
d: function (c) { | ||
return "dia" + (c === 1 ? "" : "s"); | ||
}, | ||
h: function (c) { | ||
return "hora" + (c === 1 ? "" : "s"); | ||
}, | ||
m: function (c) { | ||
return "minuto" + (c === 1 ? "" : "s"); | ||
}, | ||
s: function (c) { | ||
return "segundo" + (c === 1 ? "" : "s"); | ||
}, | ||
ms: function (c) { | ||
return "milissegundo" + (c === 1 ? "" : "s"); | ||
}, | ||
decimal: ",", | ||
}, | ||
ro: { | ||
y: function (c) { return c === 1 ? 'an' : 'ani' }, | ||
mo: function (c) { return c === 1 ? 'lună' : 'luni' }, | ||
w: function (c) { return c === 1 ? 'săptămână' : 'săptămâni' }, | ||
d: function (c) { return c === 1 ? 'zi' : 'zile' }, | ||
h: function (c) { return c === 1 ? 'oră' : 'ore' }, | ||
m: function (c) { return c === 1 ? 'minut' : 'minute' }, | ||
s: function (c) { return c === 1 ? 'secundă' : 'secunde' }, | ||
ms: function (c) { return c === 1 ? 'milisecundă' : 'milisecunde' }, | ||
decimal: ',' | ||
y: function (c) { | ||
return c === 1 ? "an" : "ani"; | ||
}, | ||
mo: function (c) { | ||
return c === 1 ? "lună" : "luni"; | ||
}, | ||
w: function (c) { | ||
return c === 1 ? "săptămână" : "săptămâni"; | ||
}, | ||
d: function (c) { | ||
return c === 1 ? "zi" : "zile"; | ||
}, | ||
h: function (c) { | ||
return c === 1 ? "oră" : "ore"; | ||
}, | ||
m: function (c) { | ||
return c === 1 ? "minut" : "minute"; | ||
}, | ||
s: function (c) { | ||
return c === 1 ? "secundă" : "secunde"; | ||
}, | ||
ms: function (c) { | ||
return c === 1 ? "milisecundă" : "milisecunde"; | ||
}, | ||
decimal: ",", | ||
}, | ||
ru: { | ||
y: function (c) { return ['лет', 'год', 'года'][getSlavicForm(c)] }, | ||
mo: function (c) { return ['месяцев', 'месяц', 'месяца'][getSlavicForm(c)] }, | ||
w: function (c) { return ['недель', 'неделя', 'недели'][getSlavicForm(c)] }, | ||
d: function (c) { return ['дней', 'день', 'дня'][getSlavicForm(c)] }, | ||
h: function (c) { return ['часов', 'час', 'часа'][getSlavicForm(c)] }, | ||
m: function (c) { return ['минут', 'минута', 'минуты'][getSlavicForm(c)] }, | ||
s: function (c) { return ['секунд', 'секунда', 'секунды'][getSlavicForm(c)] }, | ||
ms: function (c) { return ['миллисекунд', 'миллисекунда', 'миллисекунды'][getSlavicForm(c)] }, | ||
decimal: ',' | ||
y: function (c) { | ||
return ["лет", "год", "года"][getSlavicForm(c)]; | ||
}, | ||
mo: function (c) { | ||
return ["месяцев", "месяц", "месяца"][getSlavicForm(c)]; | ||
}, | ||
w: function (c) { | ||
return ["недель", "неделя", "недели"][getSlavicForm(c)]; | ||
}, | ||
d: function (c) { | ||
return ["дней", "день", "дня"][getSlavicForm(c)]; | ||
}, | ||
h: function (c) { | ||
return ["часов", "час", "часа"][getSlavicForm(c)]; | ||
}, | ||
m: function (c) { | ||
return ["минут", "минута", "минуты"][getSlavicForm(c)]; | ||
}, | ||
s: function (c) { | ||
return ["секунд", "секунда", "секунды"][getSlavicForm(c)]; | ||
}, | ||
ms: function (c) { | ||
return ["миллисекунд", "миллисекунда", "миллисекунды"][ | ||
getSlavicForm(c) | ||
]; | ||
}, | ||
decimal: ",", | ||
}, | ||
uk: { | ||
y: function (c) { return ['років', 'рік', 'роки'][getSlavicForm(c)] }, | ||
mo: function (c) { return ['місяців', 'місяць', 'місяці'][getSlavicForm(c)] }, | ||
w: function (c) { return ['тижнів', 'тиждень', 'тижні'][getSlavicForm(c)] }, | ||
d: function (c) { return ['днів', 'день', 'дні'][getSlavicForm(c)] }, | ||
h: function (c) { return ['годин', 'година', 'години'][getSlavicForm(c)] }, | ||
m: function (c) { return ['хвилин', 'хвилина', 'хвилини'][getSlavicForm(c)] }, | ||
s: function (c) { return ['секунд', 'секунда', 'секунди'][getSlavicForm(c)] }, | ||
ms: function (c) { return ['мілісекунд', 'мілісекунда', 'мілісекунди'][getSlavicForm(c)] }, | ||
decimal: ',' | ||
y: function (c) { | ||
return ["років", "рік", "роки"][getSlavicForm(c)]; | ||
}, | ||
mo: function (c) { | ||
return ["місяців", "місяць", "місяці"][getSlavicForm(c)]; | ||
}, | ||
w: function (c) { | ||
return ["тижнів", "тиждень", "тижні"][getSlavicForm(c)]; | ||
}, | ||
d: function (c) { | ||
return ["днів", "день", "дні"][getSlavicForm(c)]; | ||
}, | ||
h: function (c) { | ||
return ["годин", "година", "години"][getSlavicForm(c)]; | ||
}, | ||
m: function (c) { | ||
return ["хвилин", "хвилина", "хвилини"][getSlavicForm(c)]; | ||
}, | ||
s: function (c) { | ||
return ["секунд", "секунда", "секунди"][getSlavicForm(c)]; | ||
}, | ||
ms: function (c) { | ||
return ["мілісекунд", "мілісекунда", "мілісекунди"][getSlavicForm(c)]; | ||
}, | ||
decimal: ",", | ||
}, | ||
ur: { | ||
y: 'سال', | ||
mo: function (c) { return c === 1 ? 'مہینہ' : 'مہینے' }, | ||
w: function (c) { return c === 1 ? 'ہفتہ' : 'ہفتے' }, | ||
d: 'دن', | ||
h: function (c) { return c === 1 ? 'گھنٹہ' : 'گھنٹے' }, | ||
m: 'منٹ', | ||
s: 'سیکنڈ', | ||
ms: 'ملی سیکنڈ', | ||
decimal: '.' | ||
y: "سال", | ||
mo: function (c) { | ||
return c === 1 ? "مہینہ" : "مہینے"; | ||
}, | ||
w: function (c) { | ||
return c === 1 ? "ہفتہ" : "ہفتے"; | ||
}, | ||
d: "دن", | ||
h: function (c) { | ||
return c === 1 ? "گھنٹہ" : "گھنٹے"; | ||
}, | ||
m: "منٹ", | ||
s: "سیکنڈ", | ||
ms: "ملی سیکنڈ", | ||
decimal: ".", | ||
}, | ||
sk: { | ||
y: function (c) { return ['rok', 'roky', 'roky', 'rokov'][getCzechOrSlovakForm(c)] }, | ||
mo: function (c) { return ['mesiac', 'mesiace', 'mesiace', 'mesiacov'][getCzechOrSlovakForm(c)] }, | ||
w: function (c) { return ['týždeň', 'týždne', 'týždne', 'týždňov'][getCzechOrSlovakForm(c)] }, | ||
d: function (c) { return ['deň', 'dni', 'dni', 'dní'][getCzechOrSlovakForm(c)] }, | ||
h: function (c) { return ['hodina', 'hodiny', 'hodiny', 'hodín'][getCzechOrSlovakForm(c)] }, | ||
m: function (c) { return ['minúta', 'minúty', 'minúty', 'minút'][getCzechOrSlovakForm(c)] }, | ||
s: function (c) { return ['sekunda', 'sekundy', 'sekundy', 'sekúnd'][getCzechOrSlovakForm(c)] }, | ||
ms: function (c) { return ['milisekunda', 'milisekundy', 'milisekundy', 'milisekúnd'][getCzechOrSlovakForm(c)] }, | ||
decimal: ',' | ||
y: function (c) { | ||
return ["rok", "roky", "roky", "rokov"][getCzechOrSlovakForm(c)]; | ||
}, | ||
mo: function (c) { | ||
return ["mesiac", "mesiace", "mesiace", "mesiacov"][ | ||
getCzechOrSlovakForm(c) | ||
]; | ||
}, | ||
w: function (c) { | ||
return ["týždeň", "týždne", "týždne", "týždňov"][ | ||
getCzechOrSlovakForm(c) | ||
]; | ||
}, | ||
d: function (c) { | ||
return ["deň", "dni", "dni", "dní"][getCzechOrSlovakForm(c)]; | ||
}, | ||
h: function (c) { | ||
return ["hodina", "hodiny", "hodiny", "hodín"][getCzechOrSlovakForm(c)]; | ||
}, | ||
m: function (c) { | ||
return ["minúta", "minúty", "minúty", "minút"][getCzechOrSlovakForm(c)]; | ||
}, | ||
s: function (c) { | ||
return ["sekunda", "sekundy", "sekundy", "sekúnd"][ | ||
getCzechOrSlovakForm(c) | ||
]; | ||
}, | ||
ms: function (c) { | ||
return ["milisekunda", "milisekundy", "milisekundy", "milisekúnd"][ | ||
getCzechOrSlovakForm(c) | ||
]; | ||
}, | ||
decimal: ",", | ||
}, | ||
sv: { | ||
y: 'år', | ||
mo: function (c) { return 'månad' + (c === 1 ? '' : 'er') }, | ||
w: function (c) { return 'veck' + (c === 1 ? 'a' : 'or') }, | ||
d: function (c) { return 'dag' + (c === 1 ? '' : 'ar') }, | ||
h: function (c) { return 'timm' + (c === 1 ? 'e' : 'ar') }, | ||
m: function (c) { return 'minut' + (c === 1 ? '' : 'er') }, | ||
s: function (c) { return 'sekund' + (c === 1 ? '' : 'er') }, | ||
ms: function (c) { return 'millisekund' + (c === 1 ? '' : 'er') }, | ||
decimal: ',' | ||
y: "år", | ||
mo: function (c) { | ||
return "månad" + (c === 1 ? "" : "er"); | ||
}, | ||
w: function (c) { | ||
return "veck" + (c === 1 ? "a" : "or"); | ||
}, | ||
d: function (c) { | ||
return "dag" + (c === 1 ? "" : "ar"); | ||
}, | ||
h: function (c) { | ||
return "timm" + (c === 1 ? "e" : "ar"); | ||
}, | ||
m: function (c) { | ||
return "minut" + (c === 1 ? "" : "er"); | ||
}, | ||
s: function (c) { | ||
return "sekund" + (c === 1 ? "" : "er"); | ||
}, | ||
ms: function (c) { | ||
return "millisekund" + (c === 1 ? "" : "er"); | ||
}, | ||
decimal: ",", | ||
}, | ||
sw: { | ||
y: function (c) { return c === 1 ? 'mwaka' : 'miaka' }, | ||
mo: function (c) { return c === 1 ? 'mwezi' : 'miezi' }, | ||
w: 'wiki', | ||
d: function (c) { return c === 1 ? 'siku' : 'masiku' }, | ||
h: function (c) { return c === 1 ? 'saa' : 'masaa' }, | ||
m: 'dakika', | ||
s: 'sekunde', | ||
ms: 'milisekunde', | ||
decimal: '.' | ||
y: function (c) { | ||
return c === 1 ? "mwaka" : "miaka"; | ||
}, | ||
mo: function (c) { | ||
return c === 1 ? "mwezi" : "miezi"; | ||
}, | ||
w: "wiki", | ||
d: function (c) { | ||
return c === 1 ? "siku" : "masiku"; | ||
}, | ||
h: function (c) { | ||
return c === 1 ? "saa" : "masaa"; | ||
}, | ||
m: "dakika", | ||
s: "sekunde", | ||
ms: "milisekunde", | ||
decimal: ".", | ||
}, | ||
tr: { | ||
y: 'yıl', | ||
mo: 'ay', | ||
w: 'hafta', | ||
d: 'gün', | ||
h: 'saat', | ||
m: 'dakika', | ||
s: 'saniye', | ||
ms: 'milisaniye', | ||
decimal: ',' | ||
y: "yıl", | ||
mo: "ay", | ||
w: "hafta", | ||
d: "gün", | ||
h: "saat", | ||
m: "dakika", | ||
s: "saniye", | ||
ms: "milisaniye", | ||
decimal: ",", | ||
}, | ||
th: { | ||
y: 'ปี', | ||
mo: 'เดือน', | ||
w: 'อาทิตย์', | ||
d: 'วัน', | ||
h: 'ชั่วโมง', | ||
m: 'นาที', | ||
s: 'วินาที', | ||
ms: 'มิลลิวินาที', | ||
decimal: '.' | ||
y: "ปี", | ||
mo: "เดือน", | ||
w: "อาทิตย์", | ||
d: "วัน", | ||
h: "ชั่วโมง", | ||
m: "นาที", | ||
s: "วินาที", | ||
ms: "มิลลิวินาที", | ||
decimal: ".", | ||
}, | ||
vi: { | ||
y: 'năm', | ||
mo: 'tháng', | ||
w: 'tuần', | ||
d: 'ngày', | ||
h: 'giờ', | ||
m: 'phút', | ||
s: 'giây', | ||
ms: 'mili giây', | ||
decimal: ',' | ||
y: "năm", | ||
mo: "tháng", | ||
w: "tuần", | ||
d: "ngày", | ||
h: "giờ", | ||
m: "phút", | ||
s: "giây", | ||
ms: "mili giây", | ||
decimal: ",", | ||
}, | ||
zh_CN: { | ||
y: '年', | ||
mo: '个月', | ||
w: '周', | ||
d: '天', | ||
h: '小时', | ||
m: '分钟', | ||
s: '秒', | ||
ms: '毫秒', | ||
decimal: '.' | ||
y: "年", | ||
mo: "个月", | ||
w: "周", | ||
d: "天", | ||
h: "小时", | ||
m: "分钟", | ||
s: "秒", | ||
ms: "毫秒", | ||
decimal: ".", | ||
}, | ||
zh_TW: { | ||
y: '年', | ||
mo: '個月', | ||
w: '周', | ||
d: '天', | ||
h: '小時', | ||
m: '分鐘', | ||
s: '秒', | ||
ms: '毫秒', | ||
decimal: '.' | ||
} | ||
} | ||
y: "年", | ||
mo: "個月", | ||
w: "周", | ||
d: "天", | ||
h: "小時", | ||
m: "分鐘", | ||
s: "秒", | ||
ms: "毫秒", | ||
decimal: ".", | ||
}, | ||
}; | ||
// You can create a humanizer, which returns a function with default | ||
// parameters. | ||
function humanizer (passedOptions) { | ||
var result = function humanizer (ms, humanizerOptions) { | ||
var options = extend({}, result, humanizerOptions || {}) | ||
return doHumanization(ms, options) | ||
} | ||
function humanizer(passedOptions) { | ||
var result = function humanizer(ms, humanizerOptions) { | ||
var options = extend({}, result, humanizerOptions || {}); | ||
return doHumanization(ms, options); | ||
}; | ||
return extend(result, { | ||
language: 'en', | ||
delimiter: ', ', | ||
spacer: ' ', | ||
conjunction: '', | ||
serialComma: true, | ||
units: ['y', 'mo', 'w', 'd', 'h', 'm', 's'], | ||
languages: {}, | ||
round: false, | ||
unitMeasures: { | ||
y: 31557600000, | ||
mo: 2629800000, | ||
w: 604800000, | ||
d: 86400000, | ||
h: 3600000, | ||
m: 60000, | ||
s: 1000, | ||
ms: 1 | ||
} | ||
}, passedOptions) | ||
return extend( | ||
result, | ||
{ | ||
language: "en", | ||
delimiter: ", ", | ||
spacer: " ", | ||
conjunction: "", | ||
serialComma: true, | ||
units: ["y", "mo", "w", "d", "h", "m", "s"], | ||
languages: {}, | ||
round: false, | ||
unitMeasures: { | ||
y: 31557600000, | ||
mo: 2629800000, | ||
w: 604800000, | ||
d: 86400000, | ||
h: 3600000, | ||
m: 60000, | ||
s: 1000, | ||
ms: 1, | ||
}, | ||
}, | ||
passedOptions | ||
); | ||
} | ||
// The main function is just a wrapper around a default humanizer. | ||
var humanizeDuration = humanizer({}) | ||
var humanizeDuration = humanizer({}); | ||
// Build dictionary from options | ||
function getDictionary (options) { | ||
var languagesFromOptions = [options.language] | ||
function getDictionary(options) { | ||
var languagesFromOptions = [options.language]; | ||
if (has(options, 'fallbacks')) { | ||
if (has(options, "fallbacks")) { | ||
if (isArray(options.fallbacks) && options.fallbacks.length) { | ||
languagesFromOptions = languagesFromOptions.concat(options.fallbacks) | ||
languagesFromOptions = languagesFromOptions.concat(options.fallbacks); | ||
} else { | ||
throw new Error('fallbacks must be an array with at least one element') | ||
throw new Error("fallbacks must be an array with at least one element"); | ||
} | ||
@@ -572,42 +1039,46 @@ } | ||
for (var i = 0; i < languagesFromOptions.length; i++) { | ||
var languageToTry = languagesFromOptions[i] | ||
var languageToTry = languagesFromOptions[i]; | ||
if (has(options.languages, languageToTry)) { | ||
return options.languages[languageToTry] | ||
} else if (has(languages, languageToTry)) { | ||
return languages[languageToTry] | ||
return options.languages[languageToTry]; | ||
} else if (has(LANGUAGES, languageToTry)) { | ||
return LANGUAGES[languageToTry]; | ||
} | ||
} | ||
throw new Error('No language found.') | ||
throw new Error("No language found."); | ||
} | ||
// doHumanization does the bulk of the work. | ||
function doHumanization (ms, options) { | ||
var i, len, piece | ||
function doHumanization(ms, options) { | ||
var i, len, piece; | ||
// Make sure we have a positive number. | ||
// Has the nice sideffect of turning Number objects into primitives. | ||
ms = Math.abs(ms) | ||
ms = Math.abs(ms); | ||
var dictionary = getDictionary(options) | ||
var pieces = [] | ||
var dictionary = getDictionary(options); | ||
var pieces = []; | ||
// Start at the top and keep removing units, bit by bit. | ||
var unitName, unitMS, unitCount | ||
var unitName, unitMS, unitCount; | ||
for (i = 0, len = options.units.length; i < len; i++) { | ||
unitName = options.units[i] | ||
unitMS = options.unitMeasures[unitName] | ||
unitName = options.units[i]; | ||
unitMS = options.unitMeasures[unitName]; | ||
// What's the number of full units we can fit? | ||
if (i + 1 === len) { | ||
if (has(options, 'maxDecimalPoints')) { | ||
if (has(options, "maxDecimalPoints")) { | ||
// We need to use this expValue to avoid rounding functionality of toFixed call | ||
var expValue = Math.pow(10, options.maxDecimalPoints) | ||
var unitCountFloat = (ms / unitMS) | ||
unitCount = parseFloat((Math.floor(expValue * unitCountFloat) / expValue).toFixed(options.maxDecimalPoints)) | ||
var expValue = Math.pow(10, options.maxDecimalPoints); | ||
var unitCountFloat = ms / unitMS; | ||
unitCount = parseFloat( | ||
(Math.floor(expValue * unitCountFloat) / expValue).toFixed( | ||
options.maxDecimalPoints | ||
) | ||
); | ||
} else { | ||
unitCount = ms / unitMS | ||
unitCount = ms / unitMS; | ||
} | ||
} else { | ||
unitCount = Math.floor(ms / unitMS) | ||
unitCount = Math.floor(ms / unitMS); | ||
} | ||
@@ -618,14 +1089,14 @@ | ||
unitCount: unitCount, | ||
unitName: unitName | ||
}) | ||
unitName: unitName, | ||
}); | ||
// Remove what we just figured out. | ||
ms -= unitCount * unitMS | ||
ms -= unitCount * unitMS; | ||
} | ||
var firstOccupiedUnitIndex = 0 | ||
var firstOccupiedUnitIndex = 0; | ||
for (i = 0; i < pieces.length; i++) { | ||
if (pieces[i].unitCount) { | ||
firstOccupiedUnitIndex = i | ||
break | ||
firstOccupiedUnitIndex = i; | ||
break; | ||
} | ||
@@ -635,15 +1106,22 @@ } | ||
if (options.round) { | ||
var ratioToLargerUnit, previousPiece | ||
var ratioToLargerUnit, previousPiece; | ||
for (i = pieces.length - 1; i >= 0; i--) { | ||
piece = pieces[i] | ||
piece.unitCount = Math.round(piece.unitCount) | ||
piece = pieces[i]; | ||
piece.unitCount = Math.round(piece.unitCount); | ||
if (i === 0) { break } | ||
if (i === 0) { | ||
break; | ||
} | ||
previousPiece = pieces[i - 1] | ||
previousPiece = pieces[i - 1]; | ||
ratioToLargerUnit = options.unitMeasures[previousPiece.unitName] / options.unitMeasures[piece.unitName] | ||
if ((piece.unitCount % ratioToLargerUnit) === 0 || (options.largest && ((options.largest - 1) < (i - firstOccupiedUnitIndex)))) { | ||
previousPiece.unitCount += piece.unitCount / ratioToLargerUnit | ||
piece.unitCount = 0 | ||
ratioToLargerUnit = | ||
options.unitMeasures[previousPiece.unitName] / | ||
options.unitMeasures[piece.unitName]; | ||
if ( | ||
piece.unitCount % ratioToLargerUnit === 0 || | ||
(options.largest && options.largest - 1 < i - firstOccupiedUnitIndex) | ||
) { | ||
previousPiece.unitCount += piece.unitCount / ratioToLargerUnit; | ||
piece.unitCount = 0; | ||
} | ||
@@ -653,10 +1131,14 @@ } | ||
var result = [] | ||
var result = []; | ||
for (i = 0, pieces.length; i < len; i++) { | ||
piece = pieces[i] | ||
piece = pieces[i]; | ||
if (piece.unitCount) { | ||
result.push(render(piece.unitCount, piece.unitName, dictionary, options)) | ||
result.push( | ||
render(piece.unitCount, piece.unitName, dictionary, options) | ||
); | ||
} | ||
if (result.length === options.largest) { break } | ||
if (result.length === options.largest) { | ||
break; | ||
} | ||
} | ||
@@ -666,59 +1148,69 @@ | ||
if (!options.conjunction || result.length === 1) { | ||
return result.join(options.delimiter) | ||
return result.join(options.delimiter); | ||
} else if (result.length === 2) { | ||
return result.join(options.conjunction) | ||
return result.join(options.conjunction); | ||
} else if (result.length > 2) { | ||
return result.slice(0, -1).join(options.delimiter) + (options.serialComma ? ',' : '') + options.conjunction + result.slice(-1) | ||
return ( | ||
result.slice(0, -1).join(options.delimiter) + | ||
(options.serialComma ? "," : "") + | ||
options.conjunction + | ||
result.slice(-1) | ||
); | ||
} | ||
} else { | ||
return render(0, options.units[options.units.length - 1], dictionary, options) | ||
return render( | ||
0, | ||
options.units[options.units.length - 1], | ||
dictionary, | ||
options | ||
); | ||
} | ||
} | ||
function render (count, type, dictionary, options) { | ||
var decimal | ||
if (has(options, 'decimal')) { | ||
decimal = options.decimal | ||
} else if (has(dictionary, 'decimal')) { | ||
decimal = dictionary.decimal | ||
function render(count, type, dictionary, options) { | ||
var decimal; | ||
if (has(options, "decimal")) { | ||
decimal = options.decimal; | ||
} else if (has(dictionary, "decimal")) { | ||
decimal = dictionary.decimal; | ||
} else { | ||
decimal = '.' | ||
decimal = "."; | ||
} | ||
var countStr = count.toString().replace('.', decimal) | ||
var countStr = count.toString().replace(".", decimal); | ||
var dictionaryValue = dictionary[type] | ||
var word | ||
if (typeof dictionaryValue === 'function') { | ||
word = dictionaryValue(count) | ||
var dictionaryValue = dictionary[type]; | ||
var word; | ||
if (typeof dictionaryValue === "function") { | ||
word = dictionaryValue(count); | ||
} else { | ||
word = dictionaryValue | ||
word = dictionaryValue; | ||
} | ||
return countStr + options.spacer + word | ||
return countStr + options.spacer + word; | ||
} | ||
function extend (destination) { | ||
var source | ||
function extend(destination) { | ||
var source; | ||
for (var i = 1; i < arguments.length; i++) { | ||
source = arguments[i] | ||
source = arguments[i]; | ||
for (var prop in source) { | ||
if (has(source, prop)) { | ||
destination[prop] = source[prop] | ||
destination[prop] = source[prop]; | ||
} | ||
} | ||
} | ||
return destination | ||
return destination; | ||
} | ||
// Internal helper function for Polish language. | ||
function getPolishForm (c) { | ||
function getPolishForm(c) { | ||
if (c === 1) { | ||
return 0 | ||
return 0; | ||
} else if (Math.floor(c) !== c) { | ||
return 1 | ||
return 1; | ||
} else if (c % 10 >= 2 && c % 10 <= 4 && !(c % 100 > 10 && c % 100 < 20)) { | ||
return 2 | ||
return 2; | ||
} else { | ||
return 3 | ||
return 3; | ||
} | ||
@@ -728,13 +1220,17 @@ } | ||
// Internal helper function for Russian and Ukranian languages. | ||
function getSlavicForm (c) { | ||
function getSlavicForm(c) { | ||
if (Math.floor(c) !== c) { | ||
return 2 | ||
} else if ((c % 100 >= 5 && c % 100 <= 20) || (c % 10 >= 5 && c % 10 <= 9) || c % 10 === 0) { | ||
return 0 | ||
return 2; | ||
} else if ( | ||
(c % 100 >= 5 && c % 100 <= 20) || | ||
(c % 10 >= 5 && c % 10 <= 9) || | ||
c % 10 === 0 | ||
) { | ||
return 0; | ||
} else if (c % 10 === 1) { | ||
return 1 | ||
return 1; | ||
} else if (c > 1) { | ||
return 2 | ||
return 2; | ||
} else { | ||
return 0 | ||
return 0; | ||
} | ||
@@ -744,11 +1240,11 @@ } | ||
// Internal helper function for Slovak language. | ||
function getCzechOrSlovakForm (c) { | ||
function getCzechOrSlovakForm(c) { | ||
if (c === 1) { | ||
return 0 | ||
return 0; | ||
} else if (Math.floor(c) !== c) { | ||
return 1 | ||
return 1; | ||
} else if (c % 10 >= 2 && c % 10 <= 4 && c % 100 < 10) { | ||
return 2 | ||
return 2; | ||
} else { | ||
return 3 | ||
return 3; | ||
} | ||
@@ -758,9 +1254,13 @@ } | ||
// Internal helper function for Lithuanian language. | ||
function getLithuanianForm (c) { | ||
function getLithuanianForm(c) { | ||
if (c === 1 || (c % 10 === 1 && c % 100 > 20)) { | ||
return 0 | ||
} else if (Math.floor(c) !== c || (c % 10 >= 2 && c % 100 > 20) || (c % 10 >= 2 && c % 100 < 10)) { | ||
return 1 | ||
return 0; | ||
} else if ( | ||
Math.floor(c) !== c || | ||
(c % 10 >= 2 && c % 100 > 20) || | ||
(c % 10 >= 2 && c % 100 < 10) | ||
) { | ||
return 1; | ||
} else { | ||
return 2 | ||
return 2; | ||
} | ||
@@ -770,48 +1270,39 @@ } | ||
// Internal helper function for Latvian language. | ||
function getLatvianForm (c) { | ||
if (c === 1 || (c % 10 === 1 && c % 100 !== 11)) { | ||
return 0 | ||
} else { | ||
return 1 | ||
} | ||
function getLatvianForm(c) { | ||
return c % 10 === 1 && c % 100 !== 11; | ||
} | ||
// Internal helper function for Arabic language. | ||
function getArabicForm (c) { | ||
if (c <= 2) { return 0 } | ||
if (c > 2 && c < 11) { return 1 } | ||
return 0 | ||
} | ||
// We need to make sure we support browsers that don't have | ||
// `Array.isArray`, so we define a fallback here. | ||
var isArray = Array.isArray || function (arg) { | ||
return Object.prototype.toString.call(arg) === '[object Array]' | ||
} | ||
var isArray = | ||
Array.isArray || | ||
function (arg) { | ||
return Object.prototype.toString.call(arg) === "[object Array]"; | ||
}; | ||
function has (obj, key) { | ||
return Object.prototype.hasOwnProperty.call(obj, key) | ||
function has(obj, key) { | ||
return Object.prototype.hasOwnProperty.call(obj, key); | ||
} | ||
humanizeDuration.getSupportedLanguages = function getSupportedLanguages () { | ||
var result = [] | ||
for (var language in languages) { | ||
if (has(languages, language) && language !== 'gr') { | ||
result.push(language) | ||
humanizeDuration.getSupportedLanguages = function getSupportedLanguages() { | ||
var result = []; | ||
for (var language in LANGUAGES) { | ||
if (has(LANGUAGES, language) && language !== "gr") { | ||
result.push(language); | ||
} | ||
} | ||
return result | ||
} | ||
return result; | ||
}; | ||
humanizeDuration.humanizer = humanizer | ||
humanizeDuration.humanizer = humanizer; | ||
if (typeof define === 'function' && define.amd) { | ||
if (typeof define === "function" && define.amd) { | ||
define(function () { | ||
return humanizeDuration | ||
}) | ||
} else if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = humanizeDuration | ||
return humanizeDuration; | ||
}); | ||
} else if (typeof module !== "undefined" && module.exports) { | ||
module.exports = humanizeDuration; | ||
} else { | ||
this.humanizeDuration = humanizeDuration | ||
this.humanizeDuration = humanizeDuration; | ||
} | ||
})(); // eslint-disable-line semi |
@@ -24,2 +24,2 @@ This is free and unencumbered software released into the public domain. | ||
For more information, please refer to <http://unlicense.org/> | ||
For more information, please refer to <https://unlicense.org/> |
@@ -32,3 +32,3 @@ { | ||
], | ||
"version": "3.23.0", | ||
"version": "3.23.1", | ||
"description": "Convert millisecond durations to English and many other languages.", | ||
@@ -38,11 +38,14 @@ "homepage": "https://github.com/EvanHahn/HumanizeDuration.js", | ||
"scripts": { | ||
"pretest": "standard --fix", | ||
"pretest": "npm run lint", | ||
"lint": "prettier --check '**/*.{js,json,md}' && eslint '**/*.js'", | ||
"format": "prettier --write '**/*.{js,json,md}'", | ||
"test": "mocha" | ||
}, | ||
"devDependencies": { | ||
"check-ecmascript-version-compatibility": "^0.1.1", | ||
"csv-parse": "^4.10.1", | ||
"mocha": "^7.1.2", | ||
"eslint": "^7.1.0", | ||
"eslint-plugin-mocha": "^7.0.1", | ||
"mocha": "^7.2.0", | ||
"ms": "^2.1.2", | ||
"standard": "^14.3.4" | ||
"prettier": "^2.0.5" | ||
}, | ||
@@ -72,11 +75,3 @@ "keywords": [ | ||
"/humanize-duration.js" | ||
], | ||
"standard": { | ||
"globals": [ | ||
"define", | ||
"describe", | ||
"it", | ||
"before" | ||
] | ||
} | ||
] | ||
} |
221
README.md
@@ -1,6 +0,5 @@ | ||
Humanize Duration | ||
================= | ||
# Humanize Duration | ||
[![npm version](https://badge.fury.io/js/humanize-duration.svg)](https://npmjs.org/package/humanize-duration) | ||
[![build status](https://travis-ci.org/EvanHahn/HumanizeDuration.js.svg?branch=master)](https://travis-ci.org/EvanHahn/HumanizeDuration.js) | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) | ||
@@ -11,6 +10,5 @@ I have the time in milliseconds and I want it to become "30 minutes" or "3 days, 1 hour". Enter Humanize Duration! | ||
Installation | ||
------------ | ||
## Installation | ||
This package is available as *humanize-duration* on [npm](https://www.npmjs.com/package/humanize-duration) and Bower. You can also include the JavaScript file in the browser. | ||
This package is available as _humanize-duration_ on [npm](https://www.npmjs.com/package/humanize-duration) and Bower. You can also include the JavaScript file in the browser. | ||
@@ -21,4 +19,3 @@ ```sh | ||
Basic usage | ||
----------- | ||
## Basic usage | ||
@@ -28,4 +25,4 @@ With `require` (like in Node or with common build systems): | ||
```js | ||
const humanizeDuration = require('humanize-duration') | ||
humanizeDuration(12000) // '12 seconds' | ||
const humanizeDuration = require("humanize-duration"); | ||
humanizeDuration(12000); // '12 seconds' | ||
``` | ||
@@ -38,8 +35,7 @@ | ||
<script> | ||
humanizeDuration(12000) | ||
humanizeDuration(12000); | ||
</script> | ||
``` | ||
Usage | ||
----- | ||
## Usage | ||
@@ -49,5 +45,5 @@ By default, Humanize Duration will humanize down to the second, and will return a decimal for the smallest unit. It will humanize in English by default. | ||
```js | ||
humanizeDuration(3000) // '3 seconds' | ||
humanizeDuration(2250) // '2.25 seconds' | ||
humanizeDuration(97320000) // '1 day, 3 hours, 2 minutes' | ||
humanizeDuration(3000); // '3 seconds' | ||
humanizeDuration(2250); // '2.25 seconds' | ||
humanizeDuration(97320000); // '1 day, 3 hours, 2 minutes' | ||
``` | ||
@@ -64,4 +60,4 @@ | ||
```js | ||
humanizeDuration(3000, { language: 'es' }) // '3 segundos' | ||
humanizeDuration(5000, { language: 'ko' }) // '5 초' | ||
humanizeDuration(3000, { language: "es" }); // '3 segundos' | ||
humanizeDuration(5000, { language: "ko" }); // '5 초' | ||
``` | ||
@@ -74,4 +70,7 @@ | ||
```js | ||
humanizeDuration(3000, { language: 'bad language', fallbacks: ['en'] }) // '3 seconds' | ||
humanizeDuration(3000, { language: 'bad language', fallbacks: ['bad language', 'es'] }) // '3 segundos' | ||
humanizeDuration(3000, { language: "bad language", fallbacks: ["en"] }); // '3 seconds' | ||
humanizeDuration(3000, { | ||
language: "bad language", | ||
fallbacks: ["bad language", "es"], | ||
}); // '3 segundos' | ||
``` | ||
@@ -84,4 +83,4 @@ | ||
```js | ||
humanizeDuration(22140000, { delimiter: ' and ' }) // '6 hours and 9 minutes' | ||
humanizeDuration(22140000, { delimiter: '--' }) // '6 hours--9 minutes' | ||
humanizeDuration(22140000, { delimiter: " and " }); // '6 hours and 9 minutes' | ||
humanizeDuration(22140000, { delimiter: "--" }); // '6 hours--9 minutes' | ||
``` | ||
@@ -94,4 +93,4 @@ | ||
```js | ||
humanizeDuration(260040000, { spacer: ' whole ' }) // '3 whole days, 14 whole minutes' | ||
humanizeDuration(260040000, { spacer: '' }) // '3days, 14minutes' | ||
humanizeDuration(260040000, { spacer: " whole " }); // '3 whole days, 14 whole minutes' | ||
humanizeDuration(260040000, { spacer: "" }); // '3days, 14minutes' | ||
``` | ||
@@ -104,4 +103,4 @@ | ||
```js | ||
humanizeDuration(1000000000000) // '31 years, 8 months, 1 week, 19 hours, 46 minutes, 40 seconds' | ||
humanizeDuration(1000000000000, { largest: 2 }) // '31 years, 8 month' | ||
humanizeDuration(1000000000000); // '31 years, 8 months, 1 week, 19 hours, 46 minutes, 40 seconds' | ||
humanizeDuration(1000000000000, { largest: 2 }); // '31 years, 8 month' | ||
``` | ||
@@ -114,5 +113,5 @@ | ||
```js | ||
humanizeDuration(3600000, { units: ['h'] }) // '1 hour' | ||
humanizeDuration(3600000, { units: ['m'] }) // '60 minutes' | ||
humanizeDuration(3600000, { units: ['d', 'h'] }) // '1 hour' | ||
humanizeDuration(3600000, { units: ["h"] }); // '1 hour' | ||
humanizeDuration(3600000, { units: ["m"] }); // '60 minutes' | ||
humanizeDuration(3600000, { units: ["d", "h"] }); // '1 hour' | ||
``` | ||
@@ -125,5 +124,5 @@ | ||
```js | ||
humanizeDuration(1200) // '1.2 seconds' | ||
humanizeDuration(1200, { round: true }) // '1 second' | ||
humanizeDuration(1600, { round: true }) // '2 seconds' | ||
humanizeDuration(1200); // '1.2 seconds' | ||
humanizeDuration(1200, { round: true }); // '1 second' | ||
humanizeDuration(1600, { round: true }); // '2 seconds' | ||
``` | ||
@@ -136,4 +135,4 @@ | ||
```js | ||
humanizeDuration(1200) // '1.2 seconds' | ||
humanizeDuration(1200, { decimal: ' point ' }) // '1 point 2 seconds' | ||
humanizeDuration(1200); // '1.2 seconds' | ||
humanizeDuration(1200, { decimal: " point " }); // '1 point 2 seconds' | ||
``` | ||
@@ -146,6 +145,6 @@ | ||
```js | ||
humanizeDuration(22140000, { conjunction: ' and ' }) // '6 hours and 9 minutes' | ||
humanizeDuration(22141000, { conjunction: ' and ' }) // '6 hours, 9 minutes, and 1 second' | ||
humanizeDuration(22140000, { conjunction: ' and ', serialComma: false }) // '6 hours and 9 minutes' | ||
humanizeDuration(22141000, { conjunction: ' and ', serialComma: false }) // '6 hours, 9 minutes and 1 second' | ||
humanizeDuration(22140000, { conjunction: " and " }); // '6 hours and 9 minutes' | ||
humanizeDuration(22141000, { conjunction: " and " }); // '6 hours, 9 minutes, and 1 second' | ||
humanizeDuration(22140000, { conjunction: " and ", serialComma: false }); // '6 hours and 9 minutes' | ||
humanizeDuration(22141000, { conjunction: " and ", serialComma: false }); // '6 hours, 9 minutes and 1 second' | ||
``` | ||
@@ -158,7 +157,7 @@ | ||
```js | ||
humanizeDuration(8123.456789) // 8.12 seconds | ||
humanizeDuration(8123.456789, { maxDecimalPoints: 3 }) // 8.123 seconds | ||
humanizeDuration(8123.456789, { maxDecimalPoints: 6 }) // 8.123456 seconds | ||
humanizeDuration(8123.45, { maxDecimalPoints: 6 }) // 8.12345 seconds | ||
humanizeDuration(8000, { maxDecimalPoints: 6 }) // 8 seconds | ||
humanizeDuration(8123.456789); // 8.12 seconds | ||
humanizeDuration(8123.456789, { maxDecimalPoints: 3 }); // 8.123 seconds | ||
humanizeDuration(8123.456789, { maxDecimalPoints: 6 }); // 8.123456 seconds | ||
humanizeDuration(8123.45, { maxDecimalPoints: 6 }); // 8.12345 seconds | ||
humanizeDuration(8000, { maxDecimalPoints: 6 }); // 8 seconds | ||
``` | ||
@@ -171,4 +170,5 @@ | ||
```js | ||
humanizeDuration(400) // '0.4 seconds' | ||
humanizeDuration(400, { // '1 year, 1 month, 5 days' | ||
humanizeDuration(400); // '0.4 seconds' | ||
humanizeDuration(400, { | ||
// '1 year, 1 month, 5 days' | ||
unitMeasures: { | ||
@@ -178,5 +178,5 @@ y: 365, | ||
w: 7, | ||
d: 1 | ||
} | ||
}) | ||
d: 1, | ||
}, | ||
}); | ||
``` | ||
@@ -188,7 +188,7 @@ | ||
humanizeDuration(3602000, { | ||
language: 'es', | ||
language: "es", | ||
round: true, | ||
spacer: ' glorioso ', | ||
units: ['m'] | ||
}) // '60 glorioso minutos' | ||
spacer: " glorioso ", | ||
units: ["m"], | ||
}); // '60 glorioso minutos' | ||
``` | ||
@@ -198,12 +198,12 @@ | ||
If you find yourself setting same options over and over again, you can create a *humanizer* that changes the defaults, which you can still override later. | ||
If you find yourself setting same options over and over again, you can create a _humanizer_ that changes the defaults, which you can still override later. | ||
```js | ||
const spanishHumanizer = humanizeDuration.humanizer({ | ||
language: 'es', | ||
units: ['y', 'mo', 'd'] | ||
}) | ||
language: "es", | ||
units: ["y", "mo", "d"], | ||
}); | ||
spanishHumanizer(71177400000) // '2 años, 3 meses, 2 días' | ||
spanishHumanizer(71177400000, { units: ['d', 'h'] }) // '823 días, 19.5 horas' | ||
spanishHumanizer(71177400000); // '2 años, 3 meses, 2 días' | ||
spanishHumanizer(71177400000, { units: ["d", "h"] }); // '823 días, 19.5 horas' | ||
``` | ||
@@ -215,18 +215,18 @@ | ||
const shortEnglishHumanizer = humanizeDuration.humanizer({ | ||
language: 'shortEn', | ||
language: "shortEn", | ||
languages: { | ||
shortEn: { | ||
y: () => 'y', | ||
mo: () => 'mo', | ||
w: () => 'w', | ||
d: () => 'd', | ||
h: () => 'h', | ||
m: () => 'm', | ||
s: () => 's', | ||
ms: () => 'ms', | ||
} | ||
} | ||
}) | ||
y: () => "y", | ||
mo: () => "mo", | ||
w: () => "w", | ||
d: () => "d", | ||
h: () => "h", | ||
m: () => "m", | ||
s: () => "s", | ||
ms: () => "ms", | ||
}, | ||
}, | ||
}); | ||
shortEnglishHumanizer(15600000) // '4 h, 20 m' | ||
shortEnglishHumanizer(15600000); // '4 h, 20 m' | ||
``` | ||
@@ -246,4 +246,3 @@ | ||
Supported languages | ||
------------------- | ||
## Supported languages | ||
@@ -253,3 +252,3 @@ Humanize Duration supports the following languages: | ||
| Language | Code | | ||
|----------------------|---------| | ||
| -------------------- | ------- | | ||
| Arabic | `ar` | | ||
@@ -301,3 +300,3 @@ | Bulgarian | `bg` | | ||
```js | ||
humanizeDuration.getSupportedLanguages() | ||
humanizeDuration.getSupportedLanguages(); | ||
// ['ar', 'bg', 'ca', 'cs', da', 'de', ...] | ||
@@ -308,44 +307,42 @@ ``` | ||
Credits | ||
------- | ||
## Credits | ||
Lovingly made by [Evan Hahn](http://evanhahn.com/) with help from: | ||
Lovingly made by [Evan Hahn](https://evanhahn.com/) with help from: | ||
* [Martin Prins](https://github.com/magarcia) for language support | ||
* [Filipi Siqueira](https://github.com/filipi777) for Portuguese support | ||
* [Peter Rekdal Sunde](https://github.com/peters) for Norwegian support | ||
* [Michał Janiec](https://github.com/mjjaniec) for Polish support | ||
* [Eileen Li](https://github.com/eileen3) for Chinese support | ||
* [Tommy Brunn](https://github.com/Nevon) for Swedish support | ||
* [Giovanni Pellerano](https://github.com/evilaliv3) for Italian support | ||
* [Rahma Sghaier](https://twitter.com/sghaierrahma) for Arabic support | ||
* [Evgenios Kastanias](https://github.com/evgenios) for Greek support | ||
* [Oleksii Mylotskyi](https://github.com/spalax) for Ukrainian support | ||
* [Patrik Simek](https://github.com/patriksimek) for Czech support | ||
* [Toni Helminen](https://github.com/tonihelminen) for Finnish support | ||
* [Vidmantas Drasutis](https://github.com/Drasius2) for Lithuanian support | ||
* [Manh Tuan](https://github.com/J2TeaM) for Vietnamese support | ||
* [Leonard Lee](https://github.com/sheeeng) for Indonesian & Malay support | ||
* [Jesse Jackson](https://github.com/jsejcksn) for documentation help | ||
* [Óli Tómas Freysson](https://github.com/olitomas) for Icelandic support | ||
* [Saeed Ganji](https://github.com/shahabganji) for Farsi/Persian support | ||
* [Caner Elci](https://github.com/canerelci) for Bulgarian support | ||
* [Matej Kolesár](https://github.com/rasel-sk) for Slovak support | ||
* [Abdul Jalil](https://github.com/abduljalilm94) for Urdu support | ||
* [Wasuwat Limsuparhat](https://github.com/rappad) for Thai support | ||
* Malikoun for Lao support | ||
* [Villu Orav](https://github.com/villu164) for Estonian support | ||
* [Harijs Deksnis](https://github.com/arcanous) for Latvian support | ||
* [Nirmala Thapa(Subit)](https://github.com/nirmalathapa) for Faroese support | ||
* [Fahad Kassim](https://github.com/fadsel) for Swahili support | ||
- [Martin Prins](https://github.com/magarcia) for language support | ||
- [Filipi Siqueira](https://github.com/filipi777) for Portuguese support | ||
- [Peter Rekdal Sunde](https://github.com/peters) for Norwegian support | ||
- [Michał Janiec](https://github.com/mjjaniec) for Polish support | ||
- [Eileen Li](https://github.com/eileen3) for Chinese support | ||
- [Tommy Brunn](https://github.com/Nevon) for Swedish support | ||
- [Giovanni Pellerano](https://github.com/evilaliv3) for Italian support | ||
- [Rahma Sghaier](https://twitter.com/sghaierrahma) for Arabic support | ||
- [Evgenios Kastanias](https://github.com/evgenios) for Greek support | ||
- [Oleksii Mylotskyi](https://github.com/spalax) for Ukrainian support | ||
- [Patrik Simek](https://github.com/patriksimek) for Czech support | ||
- [Toni Helminen](https://github.com/tonihelminen) for Finnish support | ||
- [Vidmantas Drasutis](https://github.com/Drasius2) for Lithuanian support | ||
- [Manh Tuan](https://github.com/J2TeaM) for Vietnamese support | ||
- [Leonard Lee](https://github.com/sheeeng) for Indonesian & Malay support | ||
- [Jesse Jackson](https://github.com/jsejcksn) for documentation help | ||
- [Óli Tómas Freysson](https://github.com/olitomas) for Icelandic support | ||
- [Saeed Ganji](https://github.com/shahabganji) for Farsi/Persian support | ||
- [Caner Elci](https://github.com/canerelci) for Bulgarian support | ||
- [Matej Kolesár](https://github.com/rasel-sk) for Slovak support | ||
- [Abdul Jalil](https://github.com/abduljalilm94) for Urdu support | ||
- [Wasuwat Limsuparhat](https://github.com/rappad) for Thai support | ||
- Malikoun for Lao support | ||
- [Villu Orav](https://github.com/villu164) for Estonian support | ||
- [Harijs Deksnis](https://github.com/arcanous) for Latvian support | ||
- [Nirmala Thapa(Subit)](https://github.com/nirmalathapa) for Faroese support | ||
- [Fahad Kassim](https://github.com/fadsel) for Swahili support | ||
Licensed under the permissive [Unlicense](https://unlicense.org/). Enjoy! | ||
Related modules | ||
--------------- | ||
## Related modules | ||
* [pretty-ms](https://github.com/sindresorhus/pretty-ms) | ||
* [angularjs-humanize-duration](https://github.com/sebastianhaas/angularjs-humanize-duration) | ||
* [millisec](https://github.com/sungwoncho/millisec) | ||
* [HumanizeDuration.ts](https://github.com/Nightapes/HumanizeDuration.ts), a TypeScript version of this module | ||
* [aurelia-time](https://github.com/shahabganji/aurelia-time) | ||
- [pretty-ms](https://github.com/sindresorhus/pretty-ms) | ||
- [angularjs-humanize-duration](https://github.com/sebastianhaas/angularjs-humanize-duration) | ||
- [millisec](https://github.com/sungwoncho/millisec) | ||
- [HumanizeDuration.ts](https://github.com/Nightapes/HumanizeDuration.ts), a TypeScript version of this module | ||
- [aurelia-time](https://github.com/shahabganji/aurelia-time) |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
52183
1257
6
325
1