Commit b33b3617 authored by Douglas Camata's avatar Douglas Camata

tests: fixes more bugs related to timezone changing

parent d8119ca4
...@@ -256,13 +256,13 @@ ...@@ -256,13 +256,13 @@
test("Comparison between heterogeneous values is done with " + test("Comparison between heterogeneous values is done with " +
"the lesser precision", function () { "the lesser precision", function () {
var dmsec = JIODate('2012-05-02 06:07:08.989'), var dmsec = JIODate('2012-05-02 06:07:08.989Z'),
dsec = JIODate('2012-05-02 06:07:08'), dsec = JIODate('2012-05-02 06:07:08Z'),
dmin = JIODate('2012-05-02 06:07'), dmin = JIODate('2012-05-02 06:07Z'),
dhour = JIODate('2012-05-02 06'), dhour = JIODate('2012-05-02 06Z'),
dday = JIODate('2012-05-02'), dday = JIODate('2012-05-02', 'utc'),
dmonth = JIODate('2012-05'), dmonth = JIODate('2012-05', 'utc'),
dyear = JIODate('2012'); dyear = JIODate('2012', 'utc');
[dmsec, dsec, dmin, dhour, dday, dmonth, dyear].map(function (jiodate) { [dmsec, dsec, dmin, dhour, dday, dmonth, dyear].map(function (jiodate) {
jiodate.utcMode(); jiodate.utcMode();
...@@ -317,9 +317,9 @@ ...@@ -317,9 +317,9 @@
strictEqual(dyear.cmp(dday), 0); strictEqual(dyear.cmp(dday), 0);
strictEqual(dyear.cmp(dmonth), 0); strictEqual(dyear.cmp(dmonth), 0);
strictEqual(dmsec.cmp(JIODate('2012-05-02 06:07:07')), +1); strictEqual(dmsec.cmp(JIODate('2012-05-02 06:07:07Z')), +1);
strictEqual(dmsec.cmp(JIODate('2012-05-02 06:07:08')), 0); strictEqual(dmsec.cmp(JIODate('2012-05-02 06:07:08Z')), 0);
strictEqual(dmsec.cmp(JIODate('2012-05-02 06:07:09')), -1); strictEqual(dmsec.cmp(JIODate('2012-05-02 06:07:09Z')), -1);
}); });
}(QUnit, jiodate, moment)); }(QUnit, jiodate, moment));
...@@ -32,7 +32,11 @@ ...@@ -32,7 +32,11 @@
key_set: { key_set: {
date: { date: {
read_from: 'date', read_from: 'date',
cast_to: jiodate.JIODate cast_to: function (date_str) {
var d = jiodate.JIODate(date_str);
d.utcMode();
return d;
}
} }
} }
}, query_list = [], promise = []; }, query_list = [], promise = [];
......
...@@ -43,19 +43,19 @@ ...@@ -43,19 +43,19 @@
match_lookup: { match_lookup: {
sameDay: function (a, b) { sameDay: function (a, b) {
return ( return (
(a.getFullYear() === b.getFullYear()) && (a.getUTCFullYear() === b.getUTCFullYear()) &&
(a.getMonth() === b.getMonth()) && (a.getUTCMonth() === b.getUTCMonth()) &&
(a.getDate() === b.getDate()) (a.getUTCDate() === b.getUTCDate())
); );
}, },
sameMonth: function (a, b) { sameMonth: function (a, b) {
return ( return (
(a.getFullYear() === b.getFullYear()) && (a.getUTCFullYear() === b.getUTCFullYear()) &&
(a.getMonth() === b.getMonth()) (a.getUTCMonth() === b.getUTCMonth())
); );
}, },
sameYear: function (a, b) { sameYear: function (a, b) {
return (a.getFullYear() === b.getFullYear()); return (a.getUTCFullYear() === b.getUTCFullYear());
}, },
equalState: translationEqualityMatcher({'ouvert': 'open'}) equalState: translationEqualityMatcher({'ouvert': 'open'})
}, },
......
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
// no need to clone // no need to clone
return obj; return obj;
} }
return new Date(obj); return new Date(obj);
}; };
...@@ -98,21 +99,21 @@ ...@@ -98,21 +99,21 @@
var sameDay = function (a, b) { var sameDay = function (a, b) {
return ( return (
(a.getFullYear() === b.getFullYear()) && (a.getUTCFullYear() === b.getUTCFullYear()) &&
(a.getMonth() === b.getMonth()) && (a.getUTCMonth() === b.getUTCMonth()) &&
(a.getDate() === b.getDate()) (a.getUTCDate() === b.getUTCDate())
); );
}; };
var sameMonth = function (a, b) { var sameMonth = function (a, b) {
return ( return (
(a.getFullYear() === b.getFullYear()) && (a.getUTCFullYear() === b.getUTCFullYear()) &&
(a.getMonth() === b.getMonth()) (a.getUTCMonth() === b.getUTCMonth())
); );
}; };
var sameYear = function (a, b) { var sameYear = function (a, b) {
return (a.getFullYear() === b.getFullYear()); return (a.getUTCFullYear() === b.getUTCFullYear());
}; };
var keys = { var keys = {
...@@ -324,7 +325,7 @@ ...@@ -324,7 +325,7 @@
read_from: 'date', read_from: 'date',
cast_to: dateCast, cast_to: dateCast,
equal_match: function alwaysTrue(o1) { /*, o2*/ equal_match: function alwaysTrue(o1) { /*, o2*/
return o1.getDate() === 2; return o1.getUTCDate() === 2;
} }
} }
}, promise = []; }, promise = [];
......
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