🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

duration

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

duration - npm Package Compare versions

Comparing version

to
0.1.2

168

lib/duration.js

@@ -11,54 +11,37 @@ 'use strict';

, yfloor = require('es5-ext/lib/Date/prototype/floor-year')
, toInt = require('es5-ext/lib/Number/to-int')
, format = require('es5-ext/lib/String/prototype/format')
, map, valueOf, getYear, Duration;
, abs = Math.abs
, map, valueOf, getYear, Duration, getCalcData;
map = {
y: function () {
return String(this.year);
},
m: function () {
return pad.call(this.month, 2);
},
d: function () {
return pad.call(this.day, 2);
},
H: function () {
return pad.call(this.hour, 2);
},
M: function () {
return pad.call(this.minute, 2);
},
S: function () {
return pad.call(this.second, 2);
},
L: function () {
return pad.call(this.millisecond, 3);
},
y: function () { return String(abs(this.year)); },
m: function () { return pad.call(abs(this.month), 2); },
d: function () { return pad.call(abs(this.day), 2); },
H: function () { return pad.call(abs(this.hour), 2); },
M: function () { return pad.call(abs(this.minute), 2); },
S: function () { return pad.call(abs(this.second), 2); },
L: function () { return pad.call(abs(this.millisecond), 3); },
ms: function () {
return String(this.months);
},
ds: function () {
return String(this.days);
},
Hs: function () {
return String(this.hours);
},
Ms: function () {
return String(this.minutes);
},
Ss: function () {
return String(this.seconds);
},
Ls: function () {
return String(this.milliseconds);
}
ms: function () { return String(abs(this.months)); },
ds: function () { return String(abs(this.days)); },
Hs: function () { return String(abs(this.hours)); },
Ms: function () { return String(abs(this.minutes)); },
Ss: function () { return String(abs(this.seconds)); },
Ls: function () { return String(abs(this.milliseconds)); },
sign: function () { return (this.to < this.from) ? '-' : ''; }
};
getCalcData = function (duration) {
return (duration.to < duration.from) ?
{ to: duration.from, from: duration.to, sign: -1 } :
{ to: duration.to, from: duration.from, sign: 1 };
};
Duration = module.exports = function (from, to) {
// Make it both constructor and factory
if (!(this instanceof Duration)) {
return new Duration(from, to);
}
if (!(this instanceof Duration)) return new Duration(from, to);

@@ -70,55 +53,42 @@ this.from = date(from);

Duration.prototype = Object.create(Object.prototype, {
valueOf: d(valueOf = function () {
return this.to - this.from;
}),
millisecond: d.gs(function () {
return this.milliseconds % 1000;
}),
second: d.gs(function () {
return this.seconds % 60;
}),
minute: d.gs(function () {
return this.minutes % 60;
}),
hour: d.gs(function () {
return this.hours % 24;
}),
valueOf: d(valueOf = function () { return this.to - this.from; }),
millisecond: d.gs(function () { return this.milliseconds % 1000; }),
second: d.gs(function () { return this.seconds % 60; }),
minute: d.gs(function () { return this.minutes % 60; }),
hour: d.gs(function () { return this.hours % 24; }),
day: d.gs(function () {
var x = copy.call(this.to);
var data = getCalcData(this)
, x = copy.call(data.to);
x.setMonth(x.getMonth() - 1);
x = daysInMonth.call(x);
return (x - this.from.getDate() + this.to.getDate()) % x -
((this.from - dfloor.call(copy.call(this.from))) >
(this.to - dfloor.call(copy.call(this.to))));
return data.sign * ((x - data.from.getDate() + data.to.getDate()) % x -
((data.from - dfloor.call(copy.call(data.from))) >
(data.to - dfloor.call(copy.call(data.to)))));
}),
month: d.gs(function () {
return (12 - this.from.getMonth() + this.to.getMonth()) % 12 -
((this.from - mfloor.call(copy.call(this.from))) >
(this.to - mfloor.call(copy.call(this.to))));
var data = getCalcData(this);
return data.sign * ((12 - data.from.getMonth() + data.to.getMonth()) % 12 -
((data.from - mfloor.call(copy.call(data.from))) >
(data.to - mfloor.call(copy.call(data.to)))));
}),
year: d.gs(getYear = function () {
return this.to.getFullYear() - this.from.getFullYear() -
((this.from - yfloor.call(copy.call(this.from))) >
(this.to - yfloor.call(copy.call(this.to))));
var data = getCalcData(this);
return data.sign * (data.to.getFullYear() - data.from.getFullYear() -
((data.from - yfloor.call(copy.call(data.from))) >
(data.to - yfloor.call(copy.call(data.to)))));
}),
milliseconds: d.gs(valueOf, null),
seconds: d.gs(function () {
return Math.floor(this.valueOf() / 1000);
}),
minutes: d.gs(function () {
return Math.floor(this.valueOf() / (1000 * 60));
}),
hours: d.gs(function () {
return Math.floor(this.valueOf() / (1000 * 60 * 60));
}),
seconds: d.gs(function () { return toInt(this.valueOf() / 1000); }),
minutes: d.gs(function () { return toInt(this.valueOf() / (1000 * 60)); }),
hours: d.gs(function () { return toInt(this.valueOf() / (1000 * 60 * 60)); }),
days: d.gs(function () {
return Math.floor(this.valueOf() / (1000 * 60 * 60 * 24));
return toInt(this.valueOf() / (1000 * 60 * 60 * 24));
}),
months: d.gs(function () {
return (this.to.getFullYear() - this.from.getFullYear()) * 12 +
this.to.getMonth() - this.from.getMonth() -
((this.from - mfloor.call(copy.call(this.from))) >
(this.to - mfloor.call(copy.call(this.to))));
var data = getCalcData(this);
return data.sign * ((data.to.getFullYear() - data.from.getFullYear()) * 12 +
data.to.getMonth() - data.from.getMonth() -
((data.from - mfloor.call(copy.call(data.from))) >
(data.to - mfloor.call(copy.call(data.to)))));
}),

@@ -130,15 +100,15 @@ years: d.gs(getYear),

if (!pattern) {
s = "." + pad.call(this.millisecond, 3);
s = "." + pad.call(abs(this.millisecond), 3);
if (this.seconds) {
if (this.minutes) {
s = pad.call(this.minute, 2) + ":" +
pad.call(this.second, 2) + s;
s = pad.call(abs(this.minute), 2) + ":" +
pad.call(abs(this.second), 2) + s;
if (this.hours) {
s = pad.call(this.hour, 2) + ":" + s;
s = pad.call(abs(this.hour), 2) + ":" + s;
if (this.days) {
s = this.day + "d " + s;
s = abs(this.day) + "d " + s;
if (this.months) {
s = this.month + "m " + s;
s = abs(this.month) + "m " + s;
if (this.years) {
s = this.year + "y " + s;
s = abs(this.year) + "y " + s;
}

@@ -149,19 +119,20 @@ }

} else {
s = this.second + s;
s = abs(this.second) + s;
}
}
if (this.to < this.from) (s = '-' + s);
} else if (pattern === 1) {
s = this.millisecond + "ms";
s = abs(this.millisecond) + "ms";
if (this.seconds) {
s = this.second + "s " + s;
s = abs(this.second) + "s " + s;
if (this.minutes) {
s = this.minute + "m " + s;
s = abs(this.minute) + "m " + s;
if (this.hours) {
s = this.hour + "h " + s;
s = abs(this.hour) + "h " + s;
if (this.days) {
s = this.day + "d " + s;
s = abs(this.day) + "d " + s;
if (this.months) {
s = this.month + "m " + s;
s = abs(this.month) + "m " + s;
if (this.years) {
s = this.year + "y " + s;
s = abs(this.year) + "y " + s;
}

@@ -173,2 +144,3 @@ }

}
if (this.to < this.from) (s = '-' + s);
} else {

@@ -175,0 +147,0 @@ return format.call(pattern, map, this);

{
"author": "Mariusz Nowak <medikoo+duration@medikoo.com> (http://www.medikoo.com/)",
"name": "duration",
"description": "Useful methods for working with time duration in JavaScript",
"description": "Time duration utilities",
"keywords": [

@@ -10,3 +10,3 @@ "date",

],
"version": "0.1.1",
"version": "0.1.2",
"repository": {

@@ -13,0 +13,0 @@ "url": "git://github.com/medikoo/duration.git"

@@ -158,2 +158,3 @@ # duration - Time duration utilities

* `%Ls` - `duration.milliseconds`
* `%sign` - If duration is negative outputs `-` otherwise empty string

@@ -160,0 +161,0 @@ ## Tests [![Build Status](https://secure.travis-ci.org/medikoo/duration.png?branch=master)](https://secure.travis-ci.org/medikoo/es5-ext)

@@ -21,4 +21,4 @@ 'use strict';

d2.setMilliseconds(d2.getMilliseconds() + 11);
d = t(d1, d2);
a(d.milliseconds, 11, "Milliseconds");

@@ -41,6 +41,30 @@ a(d.valueOf(), d.milliseconds, "Value");

a(d.toString(), '.011', 'String presentation');
a(d.toString(1), '11ms', 'String presentation #2');
a(d.toString(' %L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' 011.11.00.0.00.0.00.0.00.0.00.0.0 ', 'String presentation (custom)');
a(d.toString(), '.011', "String presentation");
a(d.toString(1), '11ms', "String presentation #2");
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' .011.11.00.0.00.0.00.0.00.0.00.0.0 ', "String presentation (custom)");
d = t(d2, d1);
a(d.milliseconds, -11, "Milliseconds: Negative");
a(d.valueOf(), d.milliseconds, "Value: Negative");
a(d.seconds, 0, "Seconds: Negative");
a(d.minutes, 0, "Minutes: Negative");
a(d.hours, 0, "Hours: Negative");
a(d.days, 0, "Day: Negatives");
a(d.months, 0, "Months: Negative");
a(d.years, 0, "Years: Negative");
a(d.millisecond, -11, "Trailing milliseconds: Negative");
a(d.second, 0, "Trailing seconds: Negative");
a(d.minute, 0, "Trailing minutes: Negative");
a(d.hour, 0, "Trailing hours: Negative");
a(d.day, 0, "Trailing days: Negative");
a(d.month, 0, "Trailing months: Negative");
a(d.year, 0, "Trailing years: Negative");
a(d.toString(), '-.011', "String presentation: Negative");
a(d.toString(1), '-11ms', "String presentation #2: Negative");
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' -.011.11.00.0.00.0.00.0.00.0.00.0.0 ',
"String presentation (custom): Negative");
},

@@ -52,4 +76,4 @@ "Seconds": function (a) {

d2.setSeconds(d2.getSeconds() + 7);
d = t(d1, d2);
a(d.milliseconds, 7 * 1000 + 123, "Milliseconds");

@@ -72,7 +96,31 @@ a(d.valueOf(), d.milliseconds, "Value");

a(d.toString(), '7.123', 'String presentation');
a(d.toString(1), '7s 123ms', 'String presentation #2');
a(d.toString(' %L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' 123.' + (7 * 1000 + 123) + '.07.7.00.0.00.0.00.0.00.0.0 ',
'String presentation (custom)');
a(d.toString(), '7.123', "String presentation");
a(d.toString(1), '7s 123ms', "String presentation #2");
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' .123.' + (7 * 1000 + 123) + '.07.7.00.0.00.0.00.0.00.0.0 ',
"String presentation (custom)");
d = t(d2, d1);
a(d.milliseconds, -(7 * 1000 + 123), "Milliseconds: Negative");
a(d.valueOf(), d.milliseconds, "Value: Negative");
a(d.seconds, -7, "Seconds: Negative");
a(d.minutes, 0, "Minutes: Negative");
a(d.hours, 0, "Hours: Negative");
a(d.days, 0, "Days: Negative");
a(d.months, 0, "Months: Negative");
a(d.years, 0, "Years: Negative");
a(d.millisecond, -123, "Trailing milliseconds: Negative");
a(d.second, -7, "Trailing seconds: Negative");
a(d.minute, 0, "Trailing minutes: Negative");
a(d.hour, 0, "Trailing hours: Negative");
a(d.day, 0, "Trailing days: Negative");
a(d.month, 0, "Trailing months: Negative");
a(d.year, 0, "Trailing years: Negative");
a(d.toString(), '-7.123', "String presentation: Negative");
a(d.toString(1), '-7s 123ms', "String presentation #2: Negative");
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' -.123.' + (7 * 1000 + 123) + '.07.7.00.0.00.0.00.0.00.0.0 ',
"String presentation (custom): Negative");
},

@@ -85,4 +133,4 @@ "Minutes": function (a) {

d2.setMinutes(d2.getMinutes() + 7);
d = t(d1, d2);
a(d.milliseconds, 7 * 60 * 1000 + 12 * 1000 + 123, "Milliseconds");

@@ -105,7 +153,32 @@ a(d.valueOf(), d.milliseconds, "Value");

a(d.toString(), '07:12.123', 'String presentation');
a(d.toString(1), '7m 12s 123ms', 'String presentation #2');
a(d.toString(' %L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' 123.' + (7 * 60 * 1000 + 12 * 1000 + 123) + '.12.' + (7 * 60 + 12) +
'.07.7.00.0.00.0.00.0.0 ', 'String presentation (custom)');
a(d.toString(), '07:12.123', "String presentation");
a(d.toString(1), '7m 12s 123ms', "String presentation #2");
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' .123.' + (7 * 60 * 1000 + 12 * 1000 + 123) + '.12.' + (7 * 60 + 12) +
'.07.7.00.0.00.0.00.0.0 ', "String presentation (custom)");
d = t(d2, d1);
a(d.milliseconds, -(7 * 60 * 1000 + 12 * 1000 + 123),
"Milliseconds: Negative");
a(d.valueOf(), d.milliseconds, "Value: Negative");
a(d.seconds, -(7 * 60 + 12), "Seconds: Negative");
a(d.minutes, -7, "Minutes: Negative");
a(d.hours, 0, "Hours: Negative");
a(d.days, 0, "Days: Negative");
a(d.months, 0, "Months: Negative");
a(d.years, 0, "Years: Negative");
a(d.millisecond, -123, "Trailing milliseconds: Negative");
a(d.second, -12, "Trailing seconds: Negative");
a(d.minute, -7, "Trailing minutes: Negative");
a(d.hour, 0, "Trailing hours: Negative");
a(d.day, 0, "Trailing days: Negative");
a(d.month, 0, "Trailing months: Negative");
a(d.year, 0, "Trailing years: Negative");
a(d.toString(), '-07:12.123', "String presentation: Negative");
a(d.toString(1), '-7m 12s 123ms', "String presentation #2: Negative");
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' -.123.' + (7 * 60 * 1000 + 12 * 1000 + 123) + '.12.' + (7 * 60 + 12) +
'.07.7.00.0.00.0.00.0.0 ', "String presentation (custom): Negative");
},

@@ -119,4 +192,4 @@ "Hours": function (a) {

d2.setHours(d2.getHours() + 4);
d = t(d1, d2);
a(d.milliseconds,

@@ -140,8 +213,35 @@ 4 * 60 * 60 * 1000 + 7 * 60 * 1000 + 12 * 1000 + 123, "Milliseconds");

a(d.toString(), '04:07:12.123', 'String presentation');
a(d.toString(1), '4h 7m 12s 123ms', 'String presentation #2');
a(d.toString(' %L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' 123.' + (4 * 60 * 60 * 1000 + 7 * 60 * 1000 + 12 * 1000 + 123) +
a(d.toString(), '04:07:12.123', "String presentation");
a(d.toString(1), '4h 7m 12s 123ms', "String presentation #2");
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' .123.' + (4 * 60 * 60 * 1000 + 7 * 60 * 1000 + 12 * 1000 + 123) +
'.12.' + (4 * 60 * 60 + 7 * 60 + 12) + '.07.' + (4 * 60 + 7) +
'.04.4.00.0.00.0.0 ', 'String presentation (custom)');
'.04.4.00.0.00.0.0 ', "String presentation (custom)");
d = t(d2, d1);
a(d.milliseconds,
-(4 * 60 * 60 * 1000 + 7 * 60 * 1000 + 12 * 1000 + 123),
"Milliseconds: Negative");
a(d.valueOf(), d.milliseconds, "Value: Negative");
a(d.seconds, -(4 * 60 * 60 + 7 * 60 + 12), "Seconds: Negative");
a(d.minutes, -(4 * 60 + 7), "Minutes: Negative");
a(d.hours, -4, "Hours: Negative");
a(d.days, 0, "Days: Negative");
a(d.months, 0, "Months: Negative");
a(d.years, 0, "Years: Negative");
a(d.millisecond, -123, "Trailing milliseconds: Negative");
a(d.second, -12, "Trailing seconds: Negative");
a(d.minute, -7, "Trailing minutes: Negative");
a(d.hour, -4, "Trailing hours: Negative");
a(d.day, 0, "Trailing days: Negative");
a(d.month, 0, "Trailing months: Negative");
a(d.year, 0, "Trailing years: Negative");
a(d.toString(), '-04:07:12.123', "String presentation: Negative");
a(d.toString(1), '-4h 7m 12s 123ms', "String presentation #2: Negative");
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' -.123.' + (4 * 60 * 60 * 1000 + 7 * 60 * 1000 + 12 * 1000 + 123) +
'.12.' + (4 * 60 * 60 + 7 * 60 + 12) + '.07.' + (4 * 60 + 7) +
'.04.4.00.0.00.0.0 ', "String presentation (custom): Negative");
},

@@ -156,4 +256,4 @@ "Days": function (a) {

d2.setDate(d2.getDate() + 2);
d = t(d1, d2);
a(d.milliseconds, 2 * 24 * 60 * 60 * 1000 + 14 * 60 * 60 * 1000 +

@@ -178,10 +278,40 @@ 7 * 60 * 1000 + 12 * 1000 + 123, "Milliseconds");

a(d.toString(), '2d 14:07:12.123', 'String presentation');
a(d.toString(1), '2d 14h 7m 12s 123ms', 'String presentation #2');
a(d.toString(' %L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' 123.' + (2 * 24 * 60 * 60 * 1000 + 14 * 60 * 60 * 1000 +
a(d.toString(), '2d 14:07:12.123', "String presentation");
a(d.toString(1), '2d 14h 7m 12s 123ms', "String presentation #2");
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' .123.' + (2 * 24 * 60 * 60 * 1000 + 14 * 60 * 60 * 1000 +
7 * 60 * 1000 + 12 * 1000 + 123) + '.12.' +
(2 * 24 * 60 * 60 + 14 * 60 * 60 + 7 * 60 + 12) + '.07.' +
(2 * 24 * 60 + 14 * 60 + 7) + '.14.' + (2 * 24 + 14) +
'.02.2.00.0.0 ', 'String presentation (custom)');
'.02.2.00.0.0 ', "String presentation (custom)");
d = t(d2, d1);
a(d.milliseconds, -(2 * 24 * 60 * 60 * 1000 + 14 * 60 * 60 * 1000 +
7 * 60 * 1000 + 12 * 1000 + 123), "Milliseconds: Negative");
a(d.valueOf(), d.milliseconds, "Value: Negative");
a(d.seconds, -(2 * 24 * 60 * 60 + 14 * 60 * 60 + 7 * 60 + 12),
"Seconds: Negative");
a(d.minutes, -(2 * 24 * 60 + 14 * 60 + 7), "Minutes: Negative");
a(d.hours, -(2 * 24 + 14), "Hours: Negative");
a(d.days, -2, "Days: Negative");
a(d.months, 0, "Months: Negative");
a(d.years, 0, "Years: Negative");
a(d.millisecond, -123, "Trailing milliseconds: Negative");
a(d.second, -12, "Trailing seconds: Negative");
a(d.minute, -7, "Trailing minutes: Negative");
a(d.hour, -14, "Trailing hours: Negative");
a(d.day, -2, "Trailing days: Negative");
a(d.month, 0, "Trailing months: Negative");
a(d.year, 0, "Trailing years: Negative");
a(d.toString(), '-2d 14:07:12.123', "String presentation: Negative");
a(d.toString(1), '-2d 14h 7m 12s 123ms',
"String presentation #2: Negative");
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' -.123.' + (2 * 24 * 60 * 60 * 1000 + 14 * 60 * 60 * 1000 +
7 * 60 * 1000 + 12 * 1000 + 123) + '.12.' +
(2 * 24 * 60 * 60 + 14 * 60 * 60 + 7 * 60 + 12) + '.07.' +
(2 * 24 * 60 + 14 * 60 + 7) + '.14.' + (2 * 24 + 14) +
'.02.2.00.0.0 ', "String presentation (custom): Negative");
},

@@ -192,4 +322,4 @@ "Large duration": function (a) {

d2 = new Date(Date.UTC(2003, 3, 2, 1, 1, 1, 1));
d = t(d1, d2);
a(d.milliseconds, days * 24 * 60 * 60 * 1000, "Milliseconds");

@@ -212,11 +342,40 @@ a(d.valueOf(), d.milliseconds, "Value");

a(d.toString(), '2y 2m 0d 00:00:00.000', 'String presentation');
a(d.toString(1), '2y 2m 0d 0h 0m 0s 0ms', 'String presentation #2');
a(d.toString(' %L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' 000.' + (days * 24 * 60 * 60 * 1000) + '.00.' +
a(d.toString(), '2y 2m 0d 00:00:00.000', "String presentation");
a(d.toString(1), '2y 2m 0d 0h 0m 0s 0ms', "String presentation #2");
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' .000.' + (days * 24 * 60 * 60 * 1000) + '.00.' +
(days * 24 * 60 * 60) + '.00.' + (days * 24 * 60) + '.00.' +
(days * 24) + '.00.' + days + '.02.' + 26 + '.2 ',
'String presentation (custom)');
"String presentation (custom)");
d = t(d2, d1);
a(d.milliseconds, -(days * 24 * 60 * 60 * 1000),
"Milliseconds: Negative");
a(d.valueOf(), d.milliseconds, "Value: Negative");
a(d.seconds, -(days * 24 * 60 * 60), "Seconds: Negative");
a(d.minutes, -(days * 24 * 60), "Minutes: Negative");
a(d.hours, -(days * 24), "Hours: Negative");
a(d.days, -days, "Days: Negative");
a(d.months, -26, "Months: Negative");
a(d.years, -2, "Years: Negative");
a(d.millisecond, 0, "Trailing milliseconds: Negative");
a(d.second, 0, "Trailing seconds: Negative");
a(d.minute, 0, "Trailing minutes: Negative");
a(d.hour, 0, "Trailing hours: Negative");
a(d.day, 0, "Trailing days: Negative");
a(d.month, -2, "Trailing months: Negative");
a(d.year, -2, "Trailing years: Negative");
a(d.toString(), '-2y 2m 0d 00:00:00.000',
"String presentation: Negative");
a(d.toString(1), '-2y 2m 0d 0h 0m 0s 0ms',
"String presentation #2: Negative");
a(d.toString(' %sign.%L.%Ls.%S.%Ss.%M.%Ms.%H.%Hs.%d.%ds.%m.%ms.%y '),
' -.000.' + (days * 24 * 60 * 60 * 1000) + '.00.' +
(days * 24 * 60 * 60) + '.00.' + (days * 24 * 60) + '.00.' +
(days * 24) + '.00.' + days + '.02.' + 26 + '.2 ',
"String presentation (custom): Negative");
}
};
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet