-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Date inconsistencies #1763
Comments
This comment was originally written by @rbeeger I've played a bit more with this. Changing the test to test('Strange date inequality', () => Expect.equals(new Date.fromString('2012-02-08 00:00:00'), new Date(2012, 2, 8, 0, 0, 0, 0))); fixes it in the Dart VM, Dartium and Chrome But executing it in Firefox or Safari gives me: The following two tests work in Dart VM, but in Chrome I get the following errors: |
thanks. this will help a lot. |
This comment was originally written by @rbeeger That doesn't seem to fix it. Testing it with Dart Editor 4760 (the latest integration build), my three tests now consistently fail in Chrome, Firefox and Safari with The earlier failures could be explained with Timezone changes, but now I don't understand why 2012-02-08 is interpreted as 2012-01-31. Shortening the dates to only the dates without any time data, changes this a bit, but it still stays strange 17 FAIL Expectation: Strange date inequality (short). Expect.equals(expected: <2012-02-08 01:00:00.000>, actual: <2012-02-08 00:00:00.000>) fails. Somehow the date and time part get mixed up as the following tests demonstrate: with the following result: |
I will look into this tomorrow. On my latest build the tests succeed, but I just (some hours ago) submitted other changes to the Date.fromString constructor. Added Accepted label. |
This was already fixed in an earlier commit, but I added a test case in r4937. Added Fixed label. |
From the mailing-list:
The following test
test('Strange date inequality', () => Expect.equals(new
Date.fromString('2012-02-08'), new Date(2012, 2, 8, 0, 0, 0, 0)));
fails in Chrome with
11 FAIL Expectation: Strange date inequality. Expect.equals(expected:
<2012-02-08 00:00:00.000>, actual: <2012-02-07 23:00:00.000>) fails.
Apparently the second date which is created with the constructor that
does not take a timezone gets my local timezone applied (Central
European Time) and is then converted into a UTC date while the first
one stays as it is.
And if I try to get rid of those timezone problems and just define the
second date as an UTC date like this
test('Strange date inequality', () => Expect.equals(new
Date.fromString('2012-02-08'), new Date.withTimeZone(2012, 2, 8, 0, 0,
0, 0, new TimeZone.utc())));
I get
11 FAIL Expectation: Strange date inequality. Expect.equals(expected:
<2012-02-08 00:00:00.000>, actual: <2012-02-08 00:00:00.000Z>) fails.
I think most applications don't care about timezone. They just need
dates to stay as they are defined. Can we get a SimpleDate or
something like that without this timezone overhead?
Even stranger than that. Date.fromString doesn't seem to be
implemented in Dart VM. Executing the test in Dartium or directly in
Dart VM yields:
Caught UNIMPLEMENTED
The text was updated successfully, but these errors were encountered: