-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Test Failure: test-type-casting DATE #636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Which OS are you on? What is your MySQL and node version? I tried to reproduce your issue (setting computer and MySQL time zone to yours), but didn't succeed; the test always passes. |
Could you, just for fun, change the timestamp one second into the future and check whether it still fails on your system? |
@iarna I can now reproduce your problem. I don't know why the tests run fine for me, but it seems as if for any time zone west of UTC, inserting and getting back out a JavaScript connection.connect();
connection.query("USE nodetest");
connection.query("DROP TABLE test");
connection.query("CREATE TABLE IF NOT EXISTS test (id int, val date)");
var dString = '2012-05-12 00:00:00 Z'; // from the unit test
console.log(dString);
var d = new Date(dString);
console.log(d);
connection.query("INSERT INTO test(id, val) VALUES(?, ?)", [1, d]);
function compareWithOriginal(err, rows, fields) {
var someDate = rows[0].val;
if (someDate >= d && someDate <= d) {
console.log("fine");
} else {
console.log("oops: " + someDate + " != " + d);
}
}
connection.query("SELECT * FROM test", compareWithOriginal);
connection.end(); This outputs "fine" for every system time zone east of UTC (that I tested), but a message like "oops: Thu May 10 2012 21:00:00 GMT-0300 (ART) != Fri May 11 2012 21:00:00 GMT-0300 (ART)" for every one west of UTC (that I tested). I will investigate this further, but also I don't understand why -- even with "negative" time zones -- my own tests do not raise the assertion error that you see. Edit: My mistake; with any timezone west of UTC, my tests also fail - if I let them run long enough ;-) |
Fixed in dc23690. |
The specific test is this one:
The error message is:
MySQL and Node are running on the same system. The system timezone is America/New_York (-05:00 EST / -04:00 EDT). MySQL configuration is below:
The text was updated successfully, but these errors were encountered: