Commit b33b3617 authored by Douglas Camata's avatar Douglas Camata

tests: fixes more bugs related to timezone changing

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