blob: 2dab9afd8f5a0310efc30bafc407fdadb520d3ef [file] [log] [blame]
Tests for .valueAsDate with <input type=week>.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS valueAsDateFor("") is null
PASS valueAsDateFor("2007-W01").getTime() is Date.UTC(2007, 0, 1)
PASS valueAsDateFor("2008-W01").getTime() is Date.UTC(2007, 11, 31)
PASS valueAsDateFor("2003-W01").getTime() is Date.UTC(2002, 11, 30)
PASS valueAsDateFor("2004-W01").getTime() is Date.UTC(2003, 11, 29, 0, 0, 0, 0)
PASS valueAsDateFor("2010-W01").getTime() is Date.UTC(2010, 0, 4)
PASS valueAsDateFor("2005-W01").getTime() is Date.UTC(2005, 0, 3)
PASS valueAsDateFor("2006-W01").getTime() is Date.UTC(2006, 0, 2)
Various January 1st:
PASS setValueAsDateAndGetValue(1, 0, 1) is "0001-W01"
PASS setValueAsDateAndGetValue(2007, 0, 1) is "2007-W01"
PASS setValueAsDateAndGetValue(2008, 0, 1) is "2008-W01"
PASS setValueAsDateAndGetValue(2003, 0, 1) is "2003-W01"
PASS setValueAsDateAndGetValue(2004, 0, 1) is "2004-W01"
PASS setValueAsDateAndGetValue(2010, 0, 1) is "2009-W53"
PASS setValueAsDateAndGetValue(2005, 0, 1) is "2004-W53"
PASS setValueAsDateAndGetValue(2006, 0, 1) is "2005-W52"
Normal cases:
PASS setValueAsDateAndGetValue(2010, 0, 3) is "2009-W53"
PASS setValueAsDateAndGetValue(2010, 0, 4) is "2010-W01"
PASS setValueAsDateAndGetValue(2010, 0, 10) is "2010-W01"
PASS setValueAsDateAndGetValue(2010, 0, 11) is "2010-W02"
PASS setValueAsDateAndGetValue(2010, 0, 17) is "2010-W02"
PASS setValueAsDateAndGetValue(2010, 11, 31) is "2010-W52"
Around the minimum value:
PASS setValueAsDateAndGetValue(0, 11, 31) is ""
PASS setValueAsDateAndGetValue(0, 0, 1) is ""
PASS successfullyParsed is true
TEST COMPLETE