Opened 10 years ago

Closed 10 years ago

#8746 closed defect (worksforme)

Core Tests Fail on Safari 4b1/OSX: test_date_add,test_date_diff,test_date_add_diff_weekday

Reported by: Chris Mitchell Owned by: Adam Peller
Priority: high Milestone: 1.4
Component: Date Version: 1.3.0b1
Keywords: Cc:
Blocked By: Blocking:

Description

The following nightly core tests fail on Safari 4 beta 1 (only tested on OSX so far, possibly fails on Win as well):

test_date_add test_date_diff test_date_add_diff_weekday

Change History (7)

comment:1 Changed 10 years ago by Chris Mitchell

PASSED test: test_date_compare 0 ms

_AssertFailure: doh._AssertFailure: assertEqual() failed:

expected

Wed Jan 05 2000 00:00:00 GMT-0500 (EST)

but got

Wed Dec 29 1999 00:00:00 GMT-0500 (EST)

: assertEqual() failed:

expected

Wed Jan 05 2000 00:00:00 GMT-0500 (EST)

but got

Wed Dec 29 1999 00:00:00 GMT-0500 (EST)

doh._AssertFailure: assertEqual() failed:

expected

Wed Jan 05 2000 00:00:00 GMT-0500 (EST)

but got

Wed Dec 29 1999 00:00:00 GMT-0500 (EST)

ERROR IN:

function test_date_add(t) {

var interv = ; Interval (e.g., year, month) var dtA = null; Date to increment var dtB = null; Expected result date

interv = "year"; dtA = new Date(2005, 11, 27); dtB = new Date(2006, 11, 27); t.is(dtB, dojo.date.add(dtA, interv, 1));

dtA = new Date(2005, 11, 27); dtB = new Date(2004, 11, 27); t.is(dtB, dojo.date.add(dtA, interv, -1));

dtA = new Date(2000, 1, 29); dtB = new Date(2001, 1, 28); t.is(dtB, dojo.date.add(dtA, interv, 1));

dtA = new Date(2000, 1, 29); dtB = new Date(2005, 1, 28); t.is(dtB, dojo.date.add(dtA, interv, 5));

dtA = new Date(1900, 11, 31); dtB = new Date(1930, 11, 31); t.is(dtB, dojo.date.add(dtA, interv, 30));

dtA = new Date(1995, 11, 31); dtB = new Date(2030, 11, 31); t.is(dtB, dojo.date.add(dtA, interv, 35));

interv = "quarter"; dtA = new Date(2000, 0, 1); dtB = new Date(2000, 3, 1); t.is(dtB, dojo.date.add(dtA, interv, 1));

dtA = new Date(2000, 1, 29); dtB = new Date(2000, 7, 29); t.is(dtB, dojo.date.add(dtA, interv, 2));

dtA = new Date(2000, 1, 29); dtB = new Date(2001, 1, 28); t.is(dtB, dojo.date.add(dtA, interv, 4));

interv = "month"; dtA = new Date(2000, 0, 1); dtB = new Date(2000, 1, 1); t.is(dtB, dojo.date.add(dtA, interv, 1));

dtA = new Date(2000, 0, 31); dtB = new Date(2000, 1, 29); t.is(dtB, dojo.date.add(dtA, interv, 1));

dtA = new Date(2000, 1, 29); dtB = new Date(2001, 1, 28); t.is(dtB, dojo.date.add(dtA, interv, 12));

interv = "week"; dtA = new Date(2000, 0, 1); dtB = new Date(2000, 0, 8); t.is(dtB, dojo.date.add(dtA, interv, 1));

interv = "day"; dtA = new Date(2000, 0, 1); dtB = new Date(2000, 0, 2); t.is(dtB, dojo.date.add(dtA, interv, 1));

dtA = new Date(2001, 0, 1); dtB = new Date(2002, 0, 1); t.is(dtB, dojo.date.add(dtA, interv, 365));

dtA = new Date(2000, 0, 1); dtB = new Date(2001, 0, 1); t.is(dtB, dojo.date.add(dtA, interv, 366));

dtA = new Date(2000, 1, 28); dtB = new Date(2000, 1, 29); t.is(dtB, dojo.date.add(dtA, interv, 1));

dtA = new Date(2001, 1, 28); dtB = new Date(2001, 2, 1); t.is(dtB, dojo.date.add(dtA, interv, 1));

dtA = new Date(2000, 2, 1); dtB = new Date(2000, 1, 29); t.is(dtB, dojo.date.add(dtA, interv, -1));

dtA = new Date(2001, 2, 1); dtB = new Date(2001, 1, 28); t.is(dtB, dojo.date.add(dtA, interv, -1));

dtA = new Date(2000, 0, 1); dtB = new Date(1999, 11, 31); t.is(dtB, dojo.date.add(dtA, interv, -1));

interv = "weekday"; Sat, Jan 1 dtA = new Date(2000, 0, 1); Should be Mon, Jan 3 dtB = new Date(2000, 0, 3); t.is(dtB, dojo.date.add(dtA, interv, 1));

Sun, Jan 2 dtA = new Date(2000, 0, 2); Should be Mon, Jan 3 dtB = new Date(2000, 0, 3); t.is(dtB, dojo.date.add(dtA, interv, 1));

Sun, Jan 2 dtA = new Date(2000, 0, 2); Should be Fri, Jan 7 dtB = new Date(2000, 0, 7); t.is(dtB, dojo.date.add(dtA, interv, 5));

Sun, Jan 2 dtA = new Date(2000, 0, 2); Should be Mon, Jan 10 dtB = new Date(2000, 0, 10); t.is(dtB, dojo.date.add(dtA, interv, 6));

Mon, Jan 3 dtA = new Date(2000, 0, 3); Should be Mon, Jan 17 dtB = new Date(2000, 0, 17); t.is(dtB, dojo.date.add(dtA, interv, 10));

Sat, Jan 8 dtA = new Date(2000, 0, 8); Should be Mon, Jan 3 dtB = new Date(2000, 0, 3); t.is(dtB, dojo.date.add(dtA, interv, -5));

Sun, Jan 9 dtA = new Date(2000, 0, 9); Should be Wed, Jan 5 dtB = new Date(2000, 0, 5); t.is(dtB, dojo.date.add(dtA, interv, -3));

Sun, Jan 23 dtA = new Date(2000, 0, 23); Should be Fri, Jan 7 dtB = new Date(2000, 0, 7); t.is(dtB, dojo.date.add(dtA, interv, -11));

interv = "hour"; dtA = new Date(2000, 0, 1, 11); dtB = new Date(2000, 0, 1, 12); t.is(dtB, dojo.date.add(dtA, interv, 1));

dtA = new Date(2001, 9, 28, 0); dtB = new Date(dtA.getTime() + (60 * 60 * 1000)); t.is(dtB, dojo.date.add(dtA, interv, 1));

dtA = new Date(2001, 9, 28, 23); dtB = new Date(2001, 9, 29, 0); t.is(dtB, dojo.date.add(dtA, interv, 1));

dtA = new Date(2001, 11, 31, 23); dtB = new Date(2002, 0, 1, 0); t.is(dtB, dojo.date.add(dtA, interv, 1));

interv = "minute"; dtA = new Date(2000, 11, 31, 23, 59); dtB = new Date(2001, 0, 1, 0, 0); t.is(dtB, dojo.date.add(dtA, interv, 1));

dtA = new Date(2000, 11, 27, 12, 2); dtB = new Date(2000, 11, 27, 13, 2); t.is(dtB, dojo.date.add(dtA, interv, 60));

interv = "second"; dtA = new Date(2000, 11, 31, 23, 59, 59); dtB = new Date(2001, 0, 1, 0, 0, 0); t.is(dtB, dojo.date.add(dtA, interv, 1));

dtA = new Date(2000, 11, 27, 8, 10, 59); dtB = new Date(2000, 11, 27, 8, 11, 59); t.is(dtB, dojo.date.add(dtA, interv, 60));

Test environment JS Date doesn't support millisec? interv = "millisecond"; dtA = new Date(2000, 11, 31, 23, 59, 59, 999); dtB = new Date(2001, 0, 1, 0, 0, 0, 0); t.is(dtB, dojo.date.add(dtA, interv, 1)); dtA = new Date(2000, 11, 27, 8, 10, 53, 2); dtB = new Date(2000, 11, 27, 8, 10, 54, 2); t.is(dtB, dojo.date.add(dtA, interv, 1000));

}

FAILED test: test_date_add 7 ms

_AssertFailure: doh._AssertFailure: assertEqual() failed:

expected

-4

but got

-2

: assertEqual() failed:

expected

-4

but got

-2

doh._AssertFailure: assertEqual() failed:

expected

-4

but got

-2

ERROR IN:

function test_date_diff(t) {

var dtA = null; First date to compare var dtB = null; Second date to compare var interv = ; Interval to compare on (e.g., year, month)

interv = "year"; dtA = new Date(2005, 11, 27); dtB = new Date(2006, 11, 27); t.is(1, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2000, 11, 31); dtB = new Date(2001, 0, 1); t.is(1, dojo.date.difference(dtA, dtB, interv));

interv = "quarter"; dtA = new Date(2000, 1, 29); dtB = new Date(2001, 2, 1); t.is(4, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2000, 11, 1); dtB = new Date(2001, 0, 1); t.is(1, dojo.date.difference(dtA, dtB, interv));

interv = "month"; dtA = new Date(2000, 1, 29); dtB = new Date(2001, 2, 1); t.is(13, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2000, 11, 1); dtB = new Date(2001, 0, 1); t.is(1, dojo.date.difference(dtA, dtB, interv));

interv = "week"; dtA = new Date(2000, 1, 1); dtB = new Date(2000, 1, 8); t.is(1, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2000, 1, 28); dtB = new Date(2000, 2, 6); t.is(1, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2000, 2, 6); dtB = new Date(2000, 1, 28); t.is(-1, dojo.date.difference(dtA, dtB, interv));

interv = "day"; dtA = new Date(2000, 1, 29); dtB = new Date(2000, 2, 1); t.is(1, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2000, 11, 31); dtB = new Date(2001, 0, 1); t.is(1, dojo.date.difference(dtA, dtB, interv));

DST leap -- check for rounding err This is dependent on US calendar, but shouldn't break in other locales dtA = new Date(2005, 3, 3); dtB = new Date(2005, 3, 4); t.is(1, dojo.date.difference(dtA, dtB, interv));

interv = "weekday"; dtA = new Date(2006, 7, 3); dtB = new Date(2006, 7, 11); t.is(6, dojo.date.difference(dtA, dtB, interv));

Positive diffs dtA = new Date(2006, 7, 4); dtB = new Date(2006, 7, 11); t.is(5, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 7, 5); dtB = new Date(2006, 7, 11); t.is(5, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 7, 6); dtB = new Date(2006, 7, 11); t.is(5, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 7, 7); dtB = new Date(2006, 7, 11); t.is(4, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 7, 7); dtB = new Date(2006, 7, 13); t.is(4, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 7, 7); dtB = new Date(2006, 7, 14); t.is(5, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 7, 7); dtB = new Date(2006, 7, 15); t.is(6, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 7, 7); dtB = new Date(2006, 7, 28); t.is(15, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 2, 2); dtB = new Date(2006, 2, 28); t.is(18, dojo.date.difference(dtA, dtB, interv));

Negative diffs dtA = new Date(2006, 7, 11); dtB = new Date(2006, 7, 4); t.is(-5, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 7, 11); dtB = new Date(2006, 7, 5); t.is(-4, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 7, 11); dtB = new Date(2006, 7, 6); t.is(-4, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 7, 11); dtB = new Date(2006, 7, 7); t.is(-4, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 7, 13); dtB = new Date(2006, 7, 7); t.is(-5, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 7, 14); dtB = new Date(2006, 7, 7); t.is(-5, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 7, 15); dtB = new Date(2006, 7, 7); t.is(-6, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 7, 28); dtB = new Date(2006, 7, 7); t.is(-15, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2006, 2, 28); dtB = new Date(2006, 2, 2); t.is(-18, dojo.date.difference(dtA, dtB, interv));

Two days on the same weekend -- no weekday diff dtA = new Date(2006, 7, 5); dtB = new Date(2006, 7, 6); t.is(0, dojo.date.difference(dtA, dtB, interv));

interv = "hour"; dtA = new Date(2000, 11, 31, 23); dtB = new Date(2001, 0, 1, 0); t.is(1, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2000, 11, 31, 12); dtB = new Date(2001, 0, 1, 0); t.is(12, dojo.date.difference(dtA, dtB, interv));

interv = "minute"; dtA = new Date(2000, 11, 31, 23, 59); dtB = new Date(2001, 0, 1, 0, 0); t.is(1, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2000, 1, 28, 23, 59); dtB = new Date(2000, 1, 29, 0, 0); t.is(1, dojo.date.difference(dtA, dtB, interv));

interv = "second"; dtA = new Date(2000, 11, 31, 23, 59, 59); dtB = new Date(2001, 0, 1, 0, 0, 0); t.is(1, dojo.date.difference(dtA, dtB, interv));

interv = "millisecond"; dtA = new Date(2000, 11, 31, 23, 59, 59, 999); dtB = new Date(2001, 0, 1, 0, 0, 0, 0); t.is(1, dojo.date.difference(dtA, dtB, interv));

dtA = new Date(2000, 11, 31, 23, 59, 59, 0); dtB = new Date(2001, 0, 1, 0, 0, 0, 0); t.is(1000, dojo.date.difference(dtA, dtB, interv));

}

FAILED test: test_date_diff 6 ms PASSED test: test_date_add_diff_year 1 ms PASSED test: test_date_add_diff_quarter 1 ms PASSED test: test_date_add_diff_month 0 ms PASSED test: test_date_add_diff_week 1 ms PASSED test: test_date_add_diff_day 1 ms

_AssertFailure: doh._AssertFailure: assertEqual() failed:

expected

-3

but got

-5

: assertEqual() failed:

expected

-3

but got

-5

doh._AssertFailure: assertEqual() failed:

expected

-3

but got

-5

ERROR IN:

function test_date_add_diff_weekday(t) {

var interv = ; Interval (e.g., year, month) var dtA = null; Date to increment var dtB = null; Expected result date interv = "weekday"; Sat, Jan 1 dtA = new Date(2000, 0, 1); Should be Mon, Jan 3 dtB = dojo.date.add(dtA, interv, 1); t.is(dojo.date.difference(dtA, dtB, interv), 1);

Sun, Jan 2 dtA = new Date(2000, 0, 2); Should be Mon, Jan 3 dtB = dojo.date.add(dtA, interv, 1); t.is(dojo.date.difference(dtA, dtB, interv), 1);

Sun, Jan 2 dtA = new Date(2000, 0, 2); Should be Fri, Jan 7 dtB = dojo.date.add(dtA, interv, 5); t.is(dojo.date.difference(dtA, dtB, interv), 5);

Sun, Jan 2 dtA = new Date(2000, 0, 2); Should be Mon, Jan 10 dtB = dojo.date.add(dtA, interv, 6); t.is(dojo.date.difference(dtA, dtB, interv), 6);

Mon, Jan 3 dtA = new Date(2000, 0, 3); Should be Mon, Jan 17 dtB = dojo.date.add(dtA, interv, 10); t.is(dojo.date.difference(dtA, dtB, interv), 10);

Sat, Jan 8 dtA = new Date(2000, 0, 8); Should be Mon, Jan 3 dtB = dojo.date.add(dtA, interv, -5); t.is(dojo.date.difference(dtA, dtB, interv), -5);

Sun, Jan 9 dtA = new Date(2000, 0, 9); Should be Wed, Jan 5 dtB = dojo.date.add(dtA, interv, -3); t.is(dojo.date.difference(dtA, dtB, interv), -3);

Sun, Jan 23 dtA = new Date(2000, 0, 23); Should be Fri, Jan 7 dtB = dojo.date.add(dtA, interv, -11); t.is(dojo.date.difference(dtA, dtB, interv), -11);

}

FAILED test: test_date_add_diff_weekday 2 ms

comment:2 Changed 10 years ago by Adam Peller

> dojo.date.add(new Date(2000,0,9), "weekday", -3)
Wed Dec 29 1999 00:00:00 GMT-0500 (US Eastern Standard Time)

comment:3 Changed 10 years ago by Adam Peller

> parseInt(-0.6)
-1

Should be zero.

comment:4 Changed 10 years ago by Adam Peller

Anyone know how to file a Safari bug? (I presume this is in their new JS engine, not WebKit?) I used the 'bug' button in the browser but received absolutely no feedback or tracking info after hitting 'submit'. Hopefully they know about this already.

comment:5 Changed 10 years ago by bill

Milestone: tbd1.4

1.3rc1 has been release; bumping remaining tickets to 1.4 (except for documentation/testing tickets)

comment:6 Changed 10 years ago by Douglas Hays

Using the latest trunk and latest Safari 4, everything passed for me on OS/X.

comment:7 Changed 10 years ago by Adam Peller

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.