Comparing version 0.1.3 to 0.1.4
@@ -12,2 +12,3 @@ 'use strict'; | ||
, toInt = require('es5-ext/lib/Number/to-int') | ||
, toUint = require('es5-ext/lib/Number/to-uint') | ||
, format = require('es5-ext/lib/String/prototype/format') | ||
@@ -96,42 +97,72 @@ | ||
toString: d(function (pattern) { | ||
var s; | ||
if (!pattern) { | ||
s = "." + pad.call(abs(this.millisecond), 3); | ||
if (this.seconds) { | ||
if (this.minutes) { | ||
s = pad.call(abs(this.minute), 2) + ":" + | ||
pad.call(abs(this.second), 2) + s; | ||
if (this.hours) { | ||
s = pad.call(abs(this.hour), 2) + ":" + s; | ||
if (this.days) { | ||
s = abs(this.day) + "d " + s; | ||
if (this.months) { | ||
s = abs(this.month) + "m " + s; | ||
if (this.years) { | ||
s = abs(this.year) + "y " + s; | ||
toString: d(function (pattern/*, threshold*/) { | ||
var s, threshold, last; | ||
if (pattern == null) pattern = 0; | ||
if (isNaN(pattern)) return format.call(pattern, map, this); | ||
pattern = Number(pattern); | ||
threshold = toUint(arguments[1]); | ||
s = ""; | ||
if (pattern === 1) { | ||
if (threshold-- <= 0) s += abs(last = this.millisecond) + "ms"; | ||
if (this.seconds || (threshold >= 0)) { | ||
if (threshold-- <= 0) { | ||
s = abs(last = this.second) + "s" + (s ? " " : "") + s; | ||
} | ||
if (this.minutes || (threshold >= 0)) { | ||
if (threshold-- <= 0) { | ||
s = abs(last = this.minute) + "m" + (s ? " " : "") + s; | ||
} | ||
if (this.hours || (threshold >= 0)) { | ||
if (threshold-- <= 0) { | ||
s = abs(last = this.hour) + "h" + (s ? " " : "") + s; | ||
} | ||
if (this.days || (threshold >= 0)) { | ||
if (threshold-- <= 0) { | ||
s = abs(last = this.day) + "d" + (s ? " " : "") + s; | ||
} | ||
if (this.months || (threshold >= 0)) { | ||
if (threshold-- <= 0) { | ||
s = abs(last = this.month) + "m" + (s ? " " : "") + s; | ||
} | ||
if (this.years || (threshold >= 0)) { | ||
s = abs(last = this.year) + "y" + | ||
(s ? " " : "") + s; | ||
} | ||
} | ||
} | ||
} | ||
} else { | ||
s = abs(this.second) + s; | ||
} | ||
} | ||
if (this.to < this.from) (s = '-' + s); | ||
} else if (pattern === 1) { | ||
s = abs(this.millisecond) + "ms"; | ||
if (this.seconds) { | ||
s = abs(this.second) + "s " + s; | ||
if (this.minutes) { | ||
s = abs(this.minute) + "m " + s; | ||
if (this.hours) { | ||
s = abs(this.hour) + "h " + s; | ||
if (this.days) { | ||
s = abs(this.day) + "d " + s; | ||
if (this.months) { | ||
s = abs(this.month) + "m " + s; | ||
if (this.years) { | ||
s = abs(this.year) + "y " + s; | ||
} else { | ||
if (threshold-- <= 0) { | ||
s += "." + pad.call(abs(last = this.millisecond), 3); | ||
} | ||
if (this.seconds || (threshold >= 0)) { | ||
if (threshold-- <= 0) { | ||
last = this.second; | ||
s = (this.minutes ? pad.call(abs(last), 2) : | ||
abs(last)) + s; | ||
} | ||
if (this.minutes || (threshold >= 0)) { | ||
if (threshold-- <= 0) { | ||
last = this.minute; | ||
s = ((this.hours || s) ? pad.call(abs(last), 2) : abs(last)) + | ||
(s ? ":" : "") + s; | ||
} | ||
if (this.hours || (threshold >= 0)) { | ||
if (threshold-- <= 0) { | ||
s = pad.call(abs(last = this.hour), 2) + (s ? ":" : "") + s; | ||
} | ||
if (this.days || (threshold >= 0)) { | ||
if (threshold-- <= 0) { | ||
s = abs(last = this.day) + "d" + (s ? " " : "") + s; | ||
} | ||
if (this.months || (threshold >= 0)) { | ||
if (threshold-- <= 0) { | ||
s = abs(last = this.month) + "m" + (s ? " " : "") + s; | ||
} | ||
if (this.years || (threshold >= 0)) { | ||
s = abs(last = this.year) + "y" + | ||
(s ? " " : "") + s; | ||
} | ||
} | ||
@@ -142,8 +173,6 @@ } | ||
} | ||
if (this.to < this.from) (s = '-' + s); | ||
} else { | ||
return format.call(pattern, map, this); | ||
} | ||
if (last && (this.to < this.from)) (s = '-' + s); | ||
return s; | ||
}) | ||
}); |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"repository": { | ||
@@ -13,0 +13,0 @@ "url": "git://github.com/medikoo/duration.git" |
@@ -132,6 +132,6 @@ # duration - Time duration utilities | ||
## toString([ mode | format ]) | ||
## toString([mode[, threshold]]) | ||
Returns readable representation of the duration. | ||
When invoked without arguments, returns as: | ||
When invoked without arguments (defaults to _mode=0_), returns as: | ||
@@ -144,4 +144,18 @@ 10y 2m 6d 03:23:08.456 | ||
When invoked with string, formats the duration according to given string format, where: | ||
Representation returned by default modes can be customized with threshold setting that trims lowest units: | ||
```javascript | ||
duration.toString(); // 10y 2m 6d 03:23:08.456 | ||
duration.toString(0, 1); // 10y 2m 6d 03:23:08 | ||
duration.toString(0, 2); // 10y 2m 6d 03:23 | ||
duration.toString(1); // 10y 2m 6d 3h 23m 8s 456ms | ||
duration.toString(1, 1); // 10y 2m 6d 3h 23m 8s | ||
duration.toString(1, 2); // 10y 2m 6d 3h 23m | ||
``` | ||
## toString(format) | ||
When invoked with string, formats the duration according to given pattern, where: | ||
* `%y` - `duration.year` | ||
@@ -148,0 +162,0 @@ * `%m` - `duration.month` |
@@ -41,3 +41,19 @@ 'use strict'; | ||
a(d.toString(), '.011', "String presentation"); | ||
a(d.toString(0, 0), '.011', "String presentation: Threshold #0"); | ||
a(d.toString(0, 1), '0', "String presentation: Threshold #1"); | ||
a(d.toString(0, 2), '0', "String presentation: Threshold #2"); | ||
a(d.toString(0, 3), '00', "String presentation: Threshold #3"); | ||
a(d.toString(0, 4), '0d', "String presentation: Threshold #4"); | ||
a(d.toString(0, 5), '0m', "String presentation: Threshold #5"); | ||
a(d.toString(0, 6), '0y', "String presentation: Threshold #6"); | ||
a(d.toString(0, 7), '0y', "String presentation: Threshold #7"); | ||
a(d.toString(1), '11ms', "String presentation #2"); | ||
a(d.toString(1, 0), '11ms', "String presentation #2: Threshold #0"); | ||
a(d.toString(1, 1), '0s', "String presentation #2: Threshold #1"); | ||
a(d.toString(1, 2), '0m', "String presentation #2: Threshold #2"); | ||
a(d.toString(1, 3), '0h', "String presentation #2: Threshold #3"); | ||
a(d.toString(1, 4), '0d', "String presentation #2: Threshold #4"); | ||
a(d.toString(1, 5), '0m', "String presentation #2: Threshold #5"); | ||
a(d.toString(1, 6), '0y', "String presentation #2: Threshold #6"); | ||
a(d.toString(1, 7), '0y', "String presentation #2: Threshold #7"); | ||
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '), | ||
@@ -65,3 +81,28 @@ ' .011.11.00.0.00.0.00.0.00.0.00.0.0 ', "String presentation (custom)"); | ||
a(d.toString(), '-.011', "String presentation: Negative"); | ||
a(d.toString(0, 0), '-.011', | ||
"String presentation: Negative: Threshold #0"); | ||
a(d.toString(0, 1), '0', "String presentation: Negative: Threshold #1"); | ||
a(d.toString(0, 2), '0', "String presentation: Negative: Threshold #2"); | ||
a(d.toString(0, 3), '00', "String presentation: Negative: Threshold #3"); | ||
a(d.toString(0, 4), '0d', "String presentation: Negative: Threshold #4"); | ||
a(d.toString(0, 5), '0m', "String presentation: Negative: Threshold #5"); | ||
a(d.toString(0, 6), '0y', "String presentation: Negative: Threshold #6"); | ||
a(d.toString(0, 7), '0y', "String presentation: Negative: Threshold #7"); | ||
a(d.toString(1), '-11ms', "String presentation #2: Negative"); | ||
a(d.toString(1, 0), '-11ms', | ||
"String presentation #2: Negative: Threshold #0"); | ||
a(d.toString(1, 1), '0s', | ||
"String presentation #2: Negative: Threshold #1"); | ||
a(d.toString(1, 2), '0m', | ||
"String presentation #2: Negative: Threshold #2"); | ||
a(d.toString(1, 3), '0h', | ||
"String presentation #2: Negative: Threshold #3"); | ||
a(d.toString(1, 4), '0d', | ||
"String presentation #2: Negative: Threshold #4"); | ||
a(d.toString(1, 5), '0m', | ||
"String presentation #2: Negative: Threshold #5"); | ||
a(d.toString(1, 6), '0y', | ||
"String presentation #2: Negative: Threshold #6"); | ||
a(d.toString(1, 7), '0y', | ||
"String presentation #2: Negative: Threshold #7"); | ||
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '), | ||
@@ -96,3 +137,19 @@ ' -.011.11.00.0.00.0.00.0.00.0.00.0.0 ', | ||
a(d.toString(), '7.123', "String presentation"); | ||
a(d.toString(0, 0), '7.123', "String presentation: Threshold #0"); | ||
a(d.toString(0, 1), '7', "String presentation: Threshold #1"); | ||
a(d.toString(0, 2), '0', "String presentation: Threshold #2"); | ||
a(d.toString(0, 3), '00', "String presentation: Threshold #3"); | ||
a(d.toString(0, 4), '0d', "String presentation: Threshold #4"); | ||
a(d.toString(0, 5), '0m', "String presentation: Threshold #5"); | ||
a(d.toString(0, 6), '0y', "String presentation: Threshold #6"); | ||
a(d.toString(0, 7), '0y', "String presentation: Threshold #7"); | ||
a(d.toString(1), '7s 123ms', "String presentation #2"); | ||
a(d.toString(1, 0), '7s 123ms', "String presentation #2: Threshold #0"); | ||
a(d.toString(1, 1), '7s', "String presentation #2: Threshold #1"); | ||
a(d.toString(1, 2), '0m', "String presentation #2: Threshold #2"); | ||
a(d.toString(1, 3), '0h', "String presentation #2: Threshold #3"); | ||
a(d.toString(1, 4), '0d', "String presentation #2: Threshold #4"); | ||
a(d.toString(1, 5), '0m', "String presentation #2: Threshold #5"); | ||
a(d.toString(1, 6), '0y', "String presentation #2: Threshold #6"); | ||
a(d.toString(1, 7), '0y', "String presentation #2: Threshold #7"); | ||
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '), | ||
@@ -121,3 +178,28 @@ ' .123.' + (7 * 1000 + 123) + '.07.7.00.0.00.0.00.0.00.0.0 ', | ||
a(d.toString(), '-7.123', "String presentation: Negative"); | ||
a(d.toString(0, 0), '-7.123', | ||
"String presentation: Negative: Threshold #0"); | ||
a(d.toString(0, 1), '-7', "String presentation: Negative: Threshold #1"); | ||
a(d.toString(0, 2), '0', "String presentation: Negative: Threshold #2"); | ||
a(d.toString(0, 3), '00', "String presentation: Negative: Threshold #3"); | ||
a(d.toString(0, 4), '0d', "String presentation: Negative: Threshold #4"); | ||
a(d.toString(0, 5), '0m', "String presentation: Negative: Threshold #5"); | ||
a(d.toString(0, 6), '0y', "String presentation: Negative: Threshold #6"); | ||
a(d.toString(0, 7), '0y', "String presentation: Negative: Threshold #7"); | ||
a(d.toString(1), '-7s 123ms', "String presentation #2: Negative"); | ||
a(d.toString(1, 0), '-7s 123ms', | ||
"String presentation #2: Negative: Threshold #0"); | ||
a(d.toString(1, 1), '-7s', | ||
"String presentation #2: Negative: Threshold #1"); | ||
a(d.toString(1, 2), '0m', | ||
"String presentation #2: Negative: Threshold #2"); | ||
a(d.toString(1, 3), '0h', | ||
"String presentation #2: Negative: Threshold #3"); | ||
a(d.toString(1, 4), '0d', | ||
"String presentation #2: Negative: Threshold #4"); | ||
a(d.toString(1, 5), '0m', | ||
"String presentation #2: Negative: Threshold #5"); | ||
a(d.toString(1, 6), '0y', | ||
"String presentation #2: Negative: Threshold #6"); | ||
a(d.toString(1, 7), '0y', | ||
"String presentation #2: Negative: Threshold #7"); | ||
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '), | ||
@@ -153,3 +235,20 @@ ' -.123.' + (7 * 1000 + 123) + '.07.7.00.0.00.0.00.0.00.0.0 ', | ||
a(d.toString(), '07:12.123', "String presentation"); | ||
a(d.toString(0, 0), '07:12.123', "String presentation: Threshold #0"); | ||
a(d.toString(0, 1), '07:12', "String presentation: Threshold #1"); | ||
a(d.toString(0, 2), '7', "String presentation: Threshold #2"); | ||
a(d.toString(0, 3), '00', "String presentation: Threshold #3"); | ||
a(d.toString(0, 4), '0d', "String presentation: Threshold #4"); | ||
a(d.toString(0, 5), '0m', "String presentation: Threshold #5"); | ||
a(d.toString(0, 6), '0y', "String presentation: Threshold #6"); | ||
a(d.toString(0, 7), '0y', "String presentation: Threshold #7"); | ||
a(d.toString(1), '7m 12s 123ms', "String presentation #2"); | ||
a(d.toString(1, 0), '7m 12s 123ms', | ||
"String presentation #2: Threshold #0"); | ||
a(d.toString(1, 1), '7m 12s', "String presentation #2: Threshold #1"); | ||
a(d.toString(1, 2), '7m', "String presentation #2: Threshold #2"); | ||
a(d.toString(1, 3), '0h', "String presentation #2: Threshold #3"); | ||
a(d.toString(1, 4), '0d', "String presentation #2: Threshold #4"); | ||
a(d.toString(1, 5), '0m', "String presentation #2: Threshold #5"); | ||
a(d.toString(1, 6), '0y', "String presentation #2: Threshold #6"); | ||
a(d.toString(1, 7), '0y', "String presentation #2: Threshold #7"); | ||
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '), | ||
@@ -179,3 +278,28 @@ ' .123.' + (7 * 60 * 1000 + 12 * 1000 + 123) + '.12.' + (7 * 60 + 12) + | ||
a(d.toString(), '-07:12.123', "String presentation: Negative"); | ||
a(d.toString(0, 0), '-07:12.123', | ||
"String presentation: Negative: Threshold #0"); | ||
a(d.toString(0, 1), '-07:12', | ||
"String presentation: Negative: Threshold #1"); | ||
a(d.toString(0, 2), '-7', "String presentation: Negative: Threshold #2"); | ||
a(d.toString(0, 3), '00', "String presentation: Negative: Threshold #3"); | ||
a(d.toString(0, 4), '0d', "String presentation: Negative: Threshold #4"); | ||
a(d.toString(0, 5), '0m', "String presentation: Negative: Threshold #5"); | ||
a(d.toString(0, 6), '0y', "String presentation: Negative: Threshold #6"); | ||
a(d.toString(1), '-7m 12s 123ms', "String presentation #2: Negative"); | ||
a(d.toString(1, 0), '-7m 12s 123ms', | ||
"String presentation #2: Negative: Threshold #0"); | ||
a(d.toString(1, 1), '-7m 12s', | ||
"String presentation #2: Negative: Threshold #1"); | ||
a(d.toString(1, 2), '-7m', | ||
"String presentation #2: Negative: Threshold #2"); | ||
a(d.toString(1, 3), '0h', | ||
"String presentation #2: Negative: Threshold #3"); | ||
a(d.toString(1, 4), '0d', | ||
"String presentation #2: Negative: Threshold #4"); | ||
a(d.toString(1, 5), '0m', | ||
"String presentation #2: Negative: Threshold #5"); | ||
a(d.toString(1, 6), '0y', | ||
"String presentation #2: Negative: Threshold #6"); | ||
a(d.toString(1, 7), '0y', | ||
"String presentation #2: Negative: Threshold #7"); | ||
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '), | ||
@@ -213,3 +337,20 @@ ' -.123.' + (7 * 60 * 1000 + 12 * 1000 + 123) + '.12.' + (7 * 60 + 12) + | ||
a(d.toString(), '04:07:12.123', "String presentation"); | ||
a(d.toString(0, 0), '04:07:12.123', "String presentation: Threshold #0"); | ||
a(d.toString(0, 1), '04:07:12', "String presentation: Threshold #1"); | ||
a(d.toString(0, 2), '04:07', "String presentation: Threshold #2"); | ||
a(d.toString(0, 3), '04', "String presentation: Threshold #3"); | ||
a(d.toString(0, 4), '0d', "String presentation: Threshold #4"); | ||
a(d.toString(0, 5), '0m', "String presentation: Threshold #5"); | ||
a(d.toString(0, 6), '0y', "String presentation: Threshold #6"); | ||
a(d.toString(0, 7), '0y', "String presentation: Threshold #7"); | ||
a(d.toString(1), '4h 7m 12s 123ms', "String presentation #2"); | ||
a(d.toString(1, 0), '4h 7m 12s 123ms', | ||
"String presentation #2: Threshold #0"); | ||
a(d.toString(1, 1), '4h 7m 12s', "String presentation #2: Threshold #1"); | ||
a(d.toString(1, 2), '4h 7m', "String presentation #2: Threshold #2"); | ||
a(d.toString(1, 3), '4h', "String presentation #2: Threshold #3"); | ||
a(d.toString(1, 4), '0d', "String presentation #2: Threshold #4"); | ||
a(d.toString(1, 5), '0m', "String presentation #2: Threshold #5"); | ||
a(d.toString(1, 6), '0y', "String presentation #2: Threshold #6"); | ||
a(d.toString(1, 7), '0y', "String presentation #2: Threshold #7"); | ||
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '), | ||
@@ -241,3 +382,30 @@ ' .123.' + (4 * 60 * 60 * 1000 + 7 * 60 * 1000 + 12 * 1000 + 123) + | ||
a(d.toString(), '-04:07:12.123', "String presentation: Negative"); | ||
a(d.toString(0, 0), '-04:07:12.123', | ||
"String presentation: Negative: Threshold #0"); | ||
a(d.toString(0, 1), '-04:07:12', | ||
"String presentation: Negative: Threshold #1"); | ||
a(d.toString(0, 2), '-04:07', | ||
"String presentation: Negative: Threshold #2"); | ||
a(d.toString(0, 3), '-04', "String presentation: Negative: Threshold #3"); | ||
a(d.toString(0, 4), '0d', "String presentation: Negative: Threshold #4"); | ||
a(d.toString(0, 5), '0m', "String presentation: Negative: Threshold #5"); | ||
a(d.toString(0, 6), '0y', "String presentation: Negative: Threshold #6"); | ||
a(d.toString(0, 7), '0y', "String presentation: Negative: Threshold #7"); | ||
a(d.toString(1), '-4h 7m 12s 123ms', "String presentation #2: Negative"); | ||
a(d.toString(1, 0), '-4h 7m 12s 123ms', | ||
"String presentation #2: Negative: Threshold #0"); | ||
a(d.toString(1, 1), '-4h 7m 12s', | ||
"String presentation #2: Negative: Threshold #1"); | ||
a(d.toString(1, 2), '-4h 7m', | ||
"String presentation #2: Negative: Threshold #2"); | ||
a(d.toString(1, 3), '-4h', | ||
"String presentation #2: Negative: Threshold #3"); | ||
a(d.toString(1, 4), '0d', | ||
"String presentation #2: Negative: Threshold #4"); | ||
a(d.toString(1, 5), '0m', | ||
"String presentation #2: Negative: Threshold #5"); | ||
a(d.toString(1, 6), '0y', | ||
"String presentation #2: Negative: Threshold #6"); | ||
a(d.toString(1, 7), '0y', | ||
"String presentation #2: Negative: Threshold #7"); | ||
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '), | ||
@@ -278,3 +446,22 @@ ' -.123.' + (4 * 60 * 60 * 1000 + 7 * 60 * 1000 + 12 * 1000 + 123) + | ||
a(d.toString(), '2d 14:07:12.123', "String presentation"); | ||
a(d.toString(0, 0), '2d 14:07:12.123', | ||
"String presentation: Threshold #0"); | ||
a(d.toString(0, 1), '2d 14:07:12', "String presentation: Threshold #1"); | ||
a(d.toString(0, 2), '2d 14:07', "String presentation: Threshold #2"); | ||
a(d.toString(0, 3), '2d 14', "String presentation: Threshold #3"); | ||
a(d.toString(0, 4), '2d', "String presentation: Threshold #4"); | ||
a(d.toString(0, 5), '0m', "String presentation: Threshold #5"); | ||
a(d.toString(0, 6), '0y', "String presentation: Threshold #6"); | ||
a(d.toString(0, 7), '0y', "String presentation: Threshold #7"); | ||
a(d.toString(1), '2d 14h 7m 12s 123ms', "String presentation #2"); | ||
a(d.toString(1, 0), '2d 14h 7m 12s 123ms', | ||
"String presentation #2: Threshold #0"); | ||
a(d.toString(1, 1), '2d 14h 7m 12s', | ||
"String presentation #2: Threshold #1"); | ||
a(d.toString(1, 2), '2d 14h 7m', "String presentation #2: Threshold #2"); | ||
a(d.toString(1, 3), '2d 14h', "String presentation #2: Threshold #3"); | ||
a(d.toString(1, 4), '2d', "String presentation #2: Threshold #4"); | ||
a(d.toString(1, 5), '0m', "String presentation #2: Threshold #5"); | ||
a(d.toString(1, 6), '0y', "String presentation #2: Threshold #6"); | ||
a(d.toString(1, 7), '0y', "String presentation #2: Threshold #7"); | ||
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '), | ||
@@ -308,4 +495,32 @@ ' .123.' + (2 * 24 * 60 * 60 * 1000 + 14 * 60 * 60 * 1000 + | ||
a(d.toString(), '-2d 14:07:12.123', "String presentation: Negative"); | ||
a(d.toString(0, 0), '-2d 14:07:12.123', | ||
"String presentation: Negative: Threshold #0"); | ||
a(d.toString(0, 1), '-2d 14:07:12', | ||
"String presentation: Negative: Threshold #1"); | ||
a(d.toString(0, 2), '-2d 14:07', | ||
"String presentation: Negative: Threshold #2"); | ||
a(d.toString(0, 3), '-2d 14', | ||
"String presentation: Negative: Threshold #3"); | ||
a(d.toString(0, 4), '-2d', "String presentation: Negative: Threshold #4"); | ||
a(d.toString(0, 5), '0m', "String presentation: Negative: Threshold #5"); | ||
a(d.toString(0, 6), '0y', "String presentation: Negative: Threshold #6"); | ||
a(d.toString(0, 7), '0y', "String presentation: Negative: Threshold #7"); | ||
a(d.toString(1), '-2d 14h 7m 12s 123ms', | ||
"String presentation #2: Negative"); | ||
a(d.toString(1, 0), '-2d 14h 7m 12s 123ms', | ||
"String presentation #2: Negative: Threshold #0"); | ||
a(d.toString(1, 1), '-2d 14h 7m 12s', | ||
"String presentation #2: Negative: Threshold #1"); | ||
a(d.toString(1, 2), '-2d 14h 7m', | ||
"String presentation #2: Negative: Threshold #2"); | ||
a(d.toString(1, 3), '-2d 14h', | ||
"String presentation #2: Negative: Threshold #3"); | ||
a(d.toString(1, 4), '-2d', | ||
"String presentation #2: Negative: Threshold #4"); | ||
a(d.toString(1, 5), '0m', | ||
"String presentation #2: Negative: Threshold #5"); | ||
a(d.toString(1, 6), '0y', | ||
"String presentation #2: Negative: Threshold #6"); | ||
a(d.toString(1, 7), '0y', | ||
"String presentation #2: Negative: Threshold #7"); | ||
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '), | ||
@@ -342,3 +557,26 @@ ' -.123.' + (2 * 24 * 60 * 60 * 1000 + 14 * 60 * 60 * 1000 + | ||
a(d.toString(), '2y 2m 0d 00:00:00.000', "String presentation"); | ||
a(d.toString(0, 0), '2y 2m 0d 00:00:00.000', | ||
"String presentation: Threshold #0"); | ||
a(d.toString(0, 1), '2y 2m 0d 00:00:00', | ||
"String presentation: Threshold #1"); | ||
a(d.toString(0, 2), '2y 2m 0d 00:00', | ||
"String presentation: Threshold #2"); | ||
a(d.toString(0, 3), '2y 2m 0d 00', "String presentation: Threshold #3"); | ||
a(d.toString(0, 4), '2y 2m 0d', "String presentation: Threshold #4"); | ||
a(d.toString(0, 5), '2y 2m', "String presentation: Threshold #5"); | ||
a(d.toString(0, 6), '2y', "String presentation: Threshold #6"); | ||
a(d.toString(0, 7), '2y', "String presentation: Threshold #7"); | ||
a(d.toString(1), '2y 2m 0d 0h 0m 0s 0ms', "String presentation #2"); | ||
a(d.toString(1, 0), '2y 2m 0d 0h 0m 0s 0ms', | ||
"String presentation #2: Threshold #0"); | ||
a(d.toString(1, 1), '2y 2m 0d 0h 0m 0s', | ||
"String presentation #2: Threshold #1"); | ||
a(d.toString(1, 2), '2y 2m 0d 0h 0m', | ||
"String presentation #2: Threshold #2"); | ||
a(d.toString(1, 3), '2y 2m 0d 0h', | ||
"String presentation #2: Threshold #3"); | ||
a(d.toString(1, 4), '2y 2m 0d', "String presentation #2: Threshold #4"); | ||
a(d.toString(1, 5), '2y 2m', "String presentation #2: Threshold #5"); | ||
a(d.toString(1, 6), '2y', "String presentation #2: Threshold #6"); | ||
a(d.toString(1, 7), '2y', "String presentation #2: Threshold #7"); | ||
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '), | ||
@@ -371,4 +609,34 @@ ' .000.' + (days * 24 * 60 * 60 * 1000) + '.00.' + | ||
"String presentation: Negative"); | ||
a(d.toString(0, 0), '-2y 2m 0d 00:00:00.000', | ||
"String presentation: Negative: Threshold #0"); | ||
a(d.toString(0, 1), '-2y 2m 0d 00:00:00', | ||
"String presentation: Negative: Threshold #1"); | ||
a(d.toString(0, 2), '-2y 2m 0d 00:00', | ||
"String presentation: Negative: Threshold #2"); | ||
a(d.toString(0, 3), '-2y 2m 0d 00', | ||
"String presentation: Negative: Threshold #3"); | ||
a(d.toString(0, 4), '-2y 2m 0d', | ||
"String presentation: Negative: Threshold #4"); | ||
a(d.toString(0, 5), '-2y 2m', | ||
"String presentation: Negative: Threshold #5"); | ||
a(d.toString(0, 6), '-2y', "String presentation: Negative: Threshold #6"); | ||
a(d.toString(0, 7), '-2y', "String presentation: Negative: Threshold #7"); | ||
a(d.toString(1), '-2y 2m 0d 0h 0m 0s 0ms', | ||
"String presentation #2: Negative"); | ||
a(d.toString(1, 0), '-2y 2m 0d 0h 0m 0s 0ms', | ||
"String presentation #2: Negative: Threshold #0"); | ||
a(d.toString(1, 1), '-2y 2m 0d 0h 0m 0s', | ||
"String presentation #2: Negative: Threshold #1"); | ||
a(d.toString(1, 2), '-2y 2m 0d 0h 0m', | ||
"String presentation #2: Negative: Threshold #2"); | ||
a(d.toString(1, 3), '-2y 2m 0d 0h', | ||
"String presentation #2: Negative: Threshold #3"); | ||
a(d.toString(1, 4), '-2y 2m 0d', | ||
"String presentation #2: Negative: Threshold #4"); | ||
a(d.toString(1, 5), '-2y 2m', | ||
"String presentation #2: Negative: Threshold #5"); | ||
a(d.toString(1, 6), '-2y', | ||
"String presentation #2: Negative: Threshold #6"); | ||
a(d.toString(1, 7), '-2y', | ||
"String presentation #2: Negative: Threshold #7"); | ||
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '), | ||
@@ -375,0 +643,0 @@ ' -.000.' + (days * 24 * 60 * 60 * 1000) + '.00.' + |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42703
761
177