Commit fcb5c804 authored by Douglas's avatar Douglas

jiodate: fixes tests in older firefox versions

Tests were failing because some Firefox versions cannot
parse a specific date-string. So the Date constructor
that receives only integers was used. But there is one
details: this contructor uses months from 0 to 11, so if,
for example, we want to have a date in January, we send 0
as month and not 1.
parent a0b1624f
......@@ -190,7 +190,12 @@
strictEqual(d.toPrecisionString(), '2012-05-02 06:07:08.989');
strictEqual(
d.mom.toDate().valueOf(),
new Date('2012-05-02 06:07:08.989').valueOf()
// This Date constructor needs to be used because of older Firefox
// versions that do not parse some date strings formats correctly. It
// uses months from 0 to 11. So if we want to create a date in May, we
// need to use 4 instead of 5.
//
new Date(2012, 4, 2, 6, 7, 8, 989).valueOf()
);
d = JIODate('2012-05-02 06:07:08');
......@@ -198,7 +203,7 @@
strictEqual(d.toPrecisionString(), '2012-05-02 06:07:08');
strictEqual(
d.mom.toDate().valueOf(),
new Date('2012-05-02 06:07:08.000').valueOf()
new Date(2012, 4, 2, 6, 7, 8, 0).valueOf()
);
d = JIODate('2012-05-02 06:07');
......@@ -206,7 +211,7 @@
strictEqual(d.toPrecisionString(), '2012-05-02 06:07');
strictEqual(
d.mom.toDate().valueOf(),
new Date('2012-05-02 06:07:00.000').valueOf()
new Date(2012, 4, 2, 6, 7, 0, 0).valueOf()
);
d = JIODate('2012-05-02 06');
......@@ -214,7 +219,7 @@
strictEqual(d.toPrecisionString(), '2012-05-02 06');
strictEqual(
d.mom.toDate().valueOf(),
new Date('2012-05-02 06:00:00.000').valueOf()
new Date(2012, 4, 2, 6, 0, 0, 0).valueOf()
);
d = JIODate('2012-05-02');
......@@ -222,7 +227,7 @@
strictEqual(d.toPrecisionString(), '2012-05-02');
strictEqual(
d.mom.toDate().valueOf(),
new Date('2012-05-02 00:00:00.000').valueOf()
new Date(2012, 4, 2, 0, 0, 0, 0).valueOf()
);
d = JIODate('2012-05');
......@@ -230,7 +235,7 @@
strictEqual(d.toPrecisionString(), '2012-05');
strictEqual(
d.mom.toDate().valueOf(),
new Date('2012-05-01 00:00:00.000').valueOf()
new Date(2012, 4, 1, 0, 0, 0, 0).valueOf()
);
d = JIODate('2012');
......@@ -238,7 +243,7 @@
strictEqual(d.toPrecisionString(), '2012');
strictEqual(
d.mom.toDate().valueOf(),
new Date('2012-01-01 00:00:00.000').valueOf()
new Date(2012, 0, 1, 0, 0, 0, 0).valueOf()
);
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment