| Tests for .valueAsDate with <input type=datetime>. |
| |
| On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". |
| |
| |
| PASS valueAsDateFor("") is null |
| PASS valueAsDateFor("1969-12-31T12:34:56.789Z").getTime() is Date.UTC(1969, 11, 31, 12, 34, 56, 789) |
| PASS valueAsDateFor("1970-01-01T00:00:00.000Z").getTime() is Date.UTC(1970, 0, 1, 0, 0, 0) |
| PASS valueAsDateFor("2009-12-22T11:32:11Z").getTime() is Date.UTC(2009, 11, 22, 11, 32, 11) |
| PASS setValueAsDateAndGetValue(1969, 11, 1, 0, 0, 0, 0) is "1969-12-01T00:00Z" |
| PASS setValueAsDateAndGetValue(1970, 0, 1, 10, 1, 0, 100) is "1970-01-01T10:01:00.100Z" |
| PASS setValueAsDateAndGetValue(2009, 11, 31, 23, 59, 59, 999) is "2009-12-31T23:59:59.999Z" |
| PASS setValueAsDateAndGetValue(10000, 0, 1, 12, 0, 1, 0) is "10000-01-01T12:00:01Z" |
| PASS setValueAsDateAndGetValue(-1, 9, 22, 0, 0, 0, 0) is "" |
| PASS setValueAsDateAndGetValue(0, 11, 31, 23, 59, 59, 999) is "" |
| PASS setValueAsDateAndGetValue(1, 0, 1, 0, 0, 0, 0) is "0001-01-01T00:00Z" |
| PASS setValueAsDateAndGetValue(275760, 8, 13, 0, 0, 0, 0) is "275760-09-13T00:00Z" |
| PASS setValueAsDateAndGetValue(275760, 8, 13, 0, 0, 0, 1) is "" |
| Invalid objects: |
| PASS input.value = "2010-01-01T00:00Z"; input.valueAsDate = document; input.value is "" |
| PASS input.value = "2010-01-01T00:00Z"; input.valueAsDate = null; input.value is "" |
| Step attribute value and string representation: |
| PASS input.step = "1"; setValueAsDateAndGetValue(2010, 0, 21, 0, 0, 0, 0) is "2010-01-21T00:00Z" |
| PASS input.step = "0.001"; setValueAsDateAndGetValue(2010, 0, 21, 0, 0, 0, 0) is "2010-01-21T00:00Z" |
| PASS successfullyParsed is true |
| |
| TEST COMPLETE |
| |