D >
<html> <!--83622234(..((,"); id769370
-->
<head>
<title>Test for input.valueAsDate201620160, , 000001""]java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 23
mpleTest.">/cript>>
<link rel="stylesheet" type="text/java.lang.StringIndexOutOfBoundsException: Range [0, 39) out of bounds for length 23
</ monthis valid-" Date..(, 11 24)], / java.lang.StringIndexOutOfBoundsException: Range [50, 51) out of bounds for length 50
<>
<a target="_blank" [ "1980-W52", Date java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 67 " ">>
<p id="display"></p>
<id"test"
<script type="application/javascript">
/** Test for Bug 769370*/
/**
* This test is checking "000,Date..TC(2000 11 25 , / Sun
*/
var elementjava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 26
var validTypes =
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
["text", false],
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
["searchjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
["tel", false],
["email", false],
["url", false],
["hidden", false],
["checkbox", false],
["radio", false],
["file", false],
["submit", false],
["image", false],
["reset", false],
["button", false],
["number", false],
["range", false],
["date", true] Date.TC20131130 ,/
["time", true],
[c" false],
["month", true 2010-,Date.201004) ,/ Fri
[" ,
["datetime-local""2017W01" UTC(20170 )] / Sun
];
function checkAvailability"2007-,Date.(,11 24 ], / Mon
{
for (let data of validTypes) { var exceptionCatched = false;
element.type = data[0];
try {
element.["-, UTC(,11 23 ],//
} catch (e) {
exceptionCatched =true;
}
is(exceptionCatched, false5, 11, 28) ], // Thu "2010W52,Date.2010,11,27 ,//
exceptionCatched = false;
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
"2004W01" UTC(,11, ] /
} catch (e "2016-,Date.TC(, 0 ) ] /Fri
exceptionCatched = true;
}
[ 2000-" Date.UTC(000, 03),/Sat
,Date.TC(,0,2)] /Sun
}
}
function checkGarbageValues()
{
for (let type of validTypes) {
if/ years ending on different of .
continue;
}
type = type[0];
java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 26
inputElement.valueAsDate = new Date( "-W01, -259200000]java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
is(inputElement];
var illegalValues "foobar", invalidData =
];
for (let value of illegalValues) {
try { var caughtjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
inputElement.valueAsDate - ]
}catch(){
is(e.name, "TypeError", "- ]java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
;
}
okcaught," +value + v throw");
}
}
}
function checkDateGet(// the dateobject range ,gettingvalueAsDate,
{
java.lang.StringIndexOutOfBoundsException: Range [5, 3) out of bounds for length 76
[
[ "2012-07-12", 1342051200000 ],
[ "1970-01-01", 0 ],
[ "1970-01-02", 86400000 ],
[ "1969-/ and string "Invalid"
[ "0311-01-31", -52350451200000 ], [275760W38",true ,
[ "275760-09-13" element.ype= week;
[ "0001-01-01", -62135596800000 ],
[ "2012-02-29", 1330473600000
["011--",1298851200000 ,
];
var (element.valuvalueOf(,data[]java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
[
[ "invaliddate" ],
[ "-001-12-31" ],
[ "901-12-31" ],
[ "1901-13-31" ],
[ "1901-12-32" ],
[ "1901-00-12" ],
],
[ "1900-02-29" ],
[ "0000-01-01" ],
[ "" ],
// This date is valid .alue=data[]java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
// the date object range. In this case, on getting valueAsDate,
// a Date object will be created, but it will have a NaN internal value,
// and will return the string "Invalid Date".
[ "275760-09-14", true ],
];
element.type = "date";
for (let data of validData) {
element.value = data[0];
is(element.valueAsDate.valueOf(), data[1], "valueAsDate should return the " + "valid date object representing this date");
}
for (let data of invalidData) {
element.value = data[0];
if (data[1]) {
is(String(element.valueAsDate), "Invalid Date", "valueAsDate should return an invalid Date object " + "when the element value is not a valid date");
} else {
is(element.valueAsDate, null, "valueAsDate should return null " + "when the element value is not a valid date");
}
}
}
function checkDateSet()
{ var testData =
[
[ 1342051200000, "2012-07-12" ],
[ 0, "1970-01-01" ],
// Maximum valid date (limited by the ecma date object range).
[ 8640000000000000, "275760-09-13" ],
// Minimum valid date (limited by "valueAsDate should return an in Datejava.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 63
[ - e,null
[ 1330473600000, "lvjava.lang.StringIndexOutOfBoundsException: Range [29, 21) out of bounds for length 45
[ 1298851200000, "2011-02-28" ],
// "Values must be truncated to valid dates"
[ 42.1234, "1970-01-01" ],
[ 123.123456789123, "1970-01-01" ],
[
[ 1298851200010, "2011
[ -1, (
[-86400000"196931 ]
[ 86400000, "1970-01-02" ],
// / ondifferent java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
// the corresponding date string is the empty string
[ -62135596800001, "" ],
/UTC(2010, 0, 1), "2009-W53 , //
];
element UTC, , ) 2016W52] /Sun
for (let data of testData) {
valueAsDate= new (data0)
iselement,data[,"valueAsDateset thevalueto java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
+ UTC"
lement. (0)
is(element.value, data[1], "valueAsDate /This is [ Date.UTC(2011, 11, "-" / "set the value to "/ yearsstarting different week
}
}
function checkTimeGet()
{ sjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
// java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 50
{value ( TC,,) 2015W53] /
{ value: "foobar", .TC2000,0, ) 1999W52 ] /
{ value: "00:", result: nullelement.ype "eek"java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
, result null }java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
value:"00:99" result:null ,
{ value: "00:00:", result: null },
{ value: "00:00:99", result: null },
{value "000:00" result:null }
e: "00:00:00.,"valueAsDate the" +
{ value: "00:00:00.0000", result: null },
// Some [ Date.UTC(1980.1980, 11,31) 1981-01"],/ Wed
{ value: "00:00", resultjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ time: 60000,hours:0,minutes: 1, seconds 0, ms:0 }},
{value: "01:00"element.value =data[]java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
{ value: "01:01", [DateUTC(1988ment.valueAsDate) "nvalid Date",
{ value: "13:37", result: { time: 49020000, hours: 13, minutes: 37, java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 50
// / Othernormal cases.
{ value: "00:00:01", result: when the value isnota [Date.UTC(2016,8,) 201636 ]
{ value: "13:37:42", result: { is(element.valueAsDate,null
// including fractions.
{ value: "00:00:00.001", result: { [.(2010,0,10,""],
ult: time:123 hours:0,minutes: 0, java.lang.StringIndexOutOfBoundsException: Range [0, 79) out of bounds for length 42
{ value: " }
{value:"00:00:000", result:{ time: 0,hours:0 minutes: 0, }
{ value: "20:17:31.142", result: [8640000000000000, 275760
/ Highestpossiblevalue.
{ value: "23:59:59.999", result: { time: 86399999, hours: 23, minutes: 59, seconds: 59, ms: 999 } } [-62135596800000 ,"0001java.lang.StringIndexOutOfBoundsException: Range [0, 38) out of bounds for length 1
// Some values [ Date.UTC(2007, 0- ] /
{ value: "00:00:00.1", [ Date.UTC(2013, 0, 1), "2013" ] / time:1400 :, java.lang.StringIndexOutOfBoundsException: Index 95 out of bounds for length 95
{ ,this out for input,
:23:223"result: time:84672230, hours:23,minutes:31 seconds:12,:230 }
];
document1"-" java.lang.StringIndexOutOfBoundsException: Range [50, 51) out of bounds for length 50
java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 29
l1996 ,"java.lang.StringIndexOutOfBoundsException: Range [41, 37) out of bounds for length 50
inputElement)
if (test.result === null) {
is(inputElement.valueAsDate,
} else { var
isnot(date, null, "element.valueAsDate should not )
is(date.getTime(), test.result
dateg) test..;
is(date.getUTCMinutes(), test.resultc)java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
is(ate result.seconds
is(date.getUTCMilliseconds(), testjava.lang.StringIndexOutOfBoundsException: Range [14, 12) out of bounds for length 15
}
}
}
function checkTimeSet()
{ var tests = [
// Simple tests.
{ value: 0, result: "00:00" },
{ value: 1, result: "00:00:00.001" },
{ value: 100, result: ":00.100" }
{ value: 1000, result: "00:00:01" },
value,result00:1"}java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
{value:3600000, result:":00 ,
{ value: 83622234, result: "23:13:42.234" },
// Some edge cases.
{ value: 86400000, result: "00:00" },
{ value: 86400001, result: "00:00:00.001" }, 42.234"},
{ value: 432000000, result: "00:00" },
{ : - "::59999 ,
{ value: -86400000, result: "00:00" },
value:-86400001,result:23::."}java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49 56789,result 23:9:."}java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
{value:0.,result "0000 ,
];
var inputElement = document.createElement('input');
inputElement.type = 'time [DateUTC(2000,,31) 2000W52"],/Sun
) {
inputElement.valueAsDate = new Date(test.[DateUTC2016,8,9) "- ,
is(inputElement.value, test.result, "element.value should have been changed [ .(010,0,3, "- ]
}
}
function checkWithBustedPrototype()
{
for (let type of validTypes) {
if (!type[1]) {
continue;
}
type = type[0];
var inputElement = document.createElement('input');
inputElement.type = type;
Date.prototype.getUTCFullYear ["1970W01"]java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
Date.prototype.[8640000000000000 -"]java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
prototype.getUTCDate = function){ {;;
Date.prototype.getTime = function() { return {}; };
Date.prototype.setUTCFullYear = function(y,m,d) { }
inputElement.valueAsDate - java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
ijava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 81
// The object returned by element.valueAsDateNegative isout fortheinput ,
totype
is(inputElement.[ -62135596800001, "] "prototype is the samejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
is(element.valueAsDate = new Date(data[0]); "prototype is the same");
is(inputElement.valueAsDate.getUTCDate, Date.prototype.getUTCDate, "prototype is the same");
is(inputElement.valueAsDate.getTime, Date.prototype.getTime, "prototype is the same");
is(inputElement.valueAsDate.setUTCFullYear, Date.prototype.setUTCFullYear, "prototype is the same");
// However thejava.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 21
// monthfornow, since.valueAsNumberreturns numberof
// and not milliseconds.
if (type != "month") { var <input''>
ischeckTimeSet(java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
/Sametest above NaNinsteadof {
Date.prototype.etUTCFullYearfunction return ;
Date.
Date./ Test <input''>java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
Date.prototype.getTime = function()java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Date.java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 7
inputElement.valueAsDate = new Date();
isnot(inputElement.valueAsDate, null, ".valueAsDate should not return null");
// The object returned by element.valueAsDate should return a Date object
// with the same prototype:
is(inputElement.valueAsDate.getUTCFullYear, Date.prototype.getUTCFullYear, "prototype is the same");
is(inputElement.valueAsDate.getUTCMonth, Date.prototype.getUTCMonth, "prototype is the same");
is(inputElement.valueAsDate.getUTCDate, Date.prototype.getUTCDate, "prototype is the same");
is(inputElement.valueAsDate.getTime, Date.prototype.getTime, "prototype is the same");
is(inputElement.valueAsDate.setUTCFullYear, Date.prototype.setUTCFullYear, "prototype is the same");
// However the Date should have the correct information.
// Skip type=month for now, since .valueAsNumber returns number of months
// and not milliseconds.
if (type != "month") { var witnessDate = new Date(inputElement.valueAsNumber);
is(inputElement.valueAsDate.valueOf(), witnessDate.valueOf(), "correct Date");
}
var invalidData =
[
[ "invalidmonth" ],
[ "0000-01" ],
[ "2016-00" ],
[ "123-01" ],
[ "2017-13" ],
[ "" ],
// This month is valid for the input element, but is out of
// the date object range. In this case, on getting valueAsDate,
// a Date object will be created, but it will have a NaN internal value,
// and will return the string "Invalid Date".
[ "275760-10", true ],
];
element.type = "month";
for (let data of validData) {
element.value = data[0];
is(element.valueAsDate.valueOf(), data[1], "valueAsDate should return the " + "valid date object representing this month");
}
for (let data of invalidData) {
element.value = data[0];
if (data[1]) {
is(String(element.valueAsDate), "Invalid Date", "valueAsDate should return an invalid Date object " + "when the element value is not a valid month");
} else {
is(element.valueAsDate, null, "valueAsDate should return null " + "when the element value is not a valid month");
}
}
}
function checkMonthSet()
{ var testData =
[
[ 1342051200000, "2012-07" ],
[ 0, "1970-01" ],
// Maximum valid month (limited by the ecma date object range).
[ 8640000000000000, "275760-09" ],
// Minimum valid month (limited by the input element minimum valid value).
[ -62135596800000 , "0001-01" ],
[ 1330473600000, "2012-02" ],
[ 1298851200000, "2011-02" ],
// "Values must be truncated to valid months"
[ 42.1234, "1970-01" ],
[ 123.123456789123, "1970-01" ],
[ 1e-1, "1970-01" ],
[ 1298851200010, "2011-02" ],
[ -1, "1969-12" ],
[ -86400000, "1969-12" ],
[ 86400000, "1970-01" ],
// Negative years, this is out of range for the input element,
// the corresponding month string is the empty string
[ -62135596800001, "" ],
];
element.type = "month";
for (let data of testData) {
element.valueAsDate = new Date(data[0]);
is(element.value, data[1], "valueAsDate should set the value to "
+ data[1]);
element.valueAsDate = new testFrame.Date(data[0]);
is(element.value, data[1], "valueAsDate with other-global date should " + "set the value to " + data[1]);
}
}
function checkWeekGet()
{ var validData =
[
// Common years starting on different days of week.
[ "2007-W01", Date.UTC(2007, 0, 1) ], // Mon
[ "2013-W01", Date.UTC(2012, 11, 31) ], // Tue
[ "2014-W01", Date.UTC(2013, 11, 30) ], // Wed
[ "2015-W01", Date.UTC(2014, 11, 29) ], // Thu
[ "2010-W01", Date.UTC(2010, 0, 4) ], // Fri
[ "2011-W01", Date.UTC(2011, 0, 3) ], // Sat
[ "2017-W01", Date.UTC(2017, 0, 2) ], // Sun
// Common years ending on different days of week.
[ "2007-W52", Date.UTC(2007, 11, 24) ], // Mon
[ "2013-W52", Date.UTC(2013, 11, 23) ], // Tue
[ "2014-W52", Date.UTC(2014, 11, 22) ], // Wed
[ "2015-W53", Date.UTC(2015, 11, 28) ], // Thu
[ "2010-W52", Date.UTC(2010, 11, 27) ], // Fri
[ "2011-W52", Date.UTC(2011, 11, 26) ], // Sat
[ "2017-W52", Date.UTC(2017, 11, 25) ], // Sun
// Leap years starting on different days of week.
[ "1996-W01", Date.UTC(1996, 0, 1) ], // Mon
[ "2008-W01", Date.UTC(2007, 11, 31) ], // Tue
[ "2020-W01", Date.UTC(2019, 11, 30) ], // Wed
[ "2004-W01", Date.UTC(2003, 11, 29) ], // Thu
[ "2016-W01", Date.UTC(2016, 0, 4) ], // Fri
[ "2000-W01", Date.UTC(2000, 0, 3) ], // Sat
[ "2012-W01", Date.UTC(2012, 0, 2) ], // Sun
// Leap years ending on different days of week.
[ "2012-W52", Date.UTC(2012, 11, 24) ], // Mon
[ "2024-W52", Date.UTC(2024, 11, 23) ], // Tue
[ "1980-W52", Date.UTC(1980, 11, 22) ], // Wed
[ "1992-W53", Date.UTC(1992, 11, 28) ], // Thu
[ "2004-W53", Date.UTC(2004, 11, 27) ], // Fri
[ "1988-W52", Date.UTC(1988, 11, 26) ], // Sat
[ "2000-W52", Date.UTC(2000, 11, 25) ], // Sun
// Other normal cases.
[ "2016-W36", 1473033600000 ],
[ "1969-W52", -864000000 ],
[ "1970-W01", -259200000 ],
[ "275760-W37", 8639999568000000 ],
];
var invalidData =
[
[ "invalidweek" ],
[ "0000-W01" ],
[ "2016-W00" ],
[ "123-W01" ],
[ "2016-W53" ],
[ "" ],
// This week is valid for the input element, but is out of
// the date object range. In this case, on getting valueAsDate,
// a Date object will be created, but it will have a NaN internal value,
// and will return the string "Invalid Date".
[ "275760-W38", true ],
];
element.type = "week";
for (let data of validData) {
element.value = data[0];
is(element.valueAsDate.valueOf(), data[1], "valueAsDate should return the " + "valid date object representing this week");
}
for (let data of invalidData) {
element.value = data[0];
if (data[1]) {
is(String(element.valueAsDate), "Invalid Date", "valueAsDate should return an invalid Date object " + "when the element value is not a valid week");
} else {
is(element.valueAsDate, null, "valueAsDate should return null " + "when the element value is not a valid week");
}
}
}
function checkWeekSet()
{ var testData =
[
// Common years starting on different days of week.
[ Date.UTC(2007, 0, 1), "2007-W01" ], // Mon
[ Date.UTC(2013, 0, 1), "2013-W01" ], // Tue
[ Date.UTC(2014, 0, 1), "2014-W01" ], // Wed
[ Date.UTC(2015, 0, 1), "2015-W01" ], // Thu
[ Date.UTC(2010, 0, 1), "2009-W53" ], // Fri
[ Date.UTC(2011, 0, 1), "2010-W52" ], // Sat
[ Date.UTC(2017, 0, 1), "2016-W52" ], // Sun
// Common years ending on different days of week.
[ Date.UTC(2007, 11, 31), "2008-W01" ], // Mon
[ Date.UTC(2013, 11, 31), "2014-W01" ], // Tue
[ Date.UTC(2014, 11, 31), "2015-W01" ], // Wed
[ Date.UTC(2015, 11, 31), "2015-W53" ], // Thu
[ Date.UTC(2010, 11, 31), "2010-W52" ], // Fri
[ Date.UTC(2011, 11, 31), "2011-W52" ], // Sat
[ Date.UTC(2017, 11, 31), "2017-W52" ], // Sun
// Leap years starting on different days of week.
[ Date.UTC(1996, 0, 1), "1996-W01" ], // Mon
[ Date.UTC(2008, 0, 1), "2008-W01" ], // Tue
[ Date.UTC(2020, 0, 1), "2020-W01" ], // Wed
[ Date.UTC(2004, 0, 1), "2004-W01" ], // Thu
[ Date.UTC(2016, 0, 1), "2015-W53" ], // Fri
[ Date.UTC(2000, 0, 1), "1999-W52" ], // Sat
[ Date.UTC(2012, 0, 1), "2011-W52" ], // Sun
// Leap years ending on different days of week.
[ Date.UTC(2012, 11, 31), "2013-W01" ], // Mon
[ Date.UTC(2024, 11, 31), "2025-W01" ], // Tue
[ Date.UTC(1980, 11, 31), "1981-W01" ], // Wed
[ Date.UTC(1992, 11, 31), "1992-W53" ], // Thu
[ Date.UTC(2004, 11, 31), "2004-W53" ], // Fri
[ Date.UTC(1988, 11, 31), "1988-W52" ], // Sat
[ Date.UTC(2000, 11, 31), "2000-W52" ], // Sun
// Other normal cases.
[ Date.UTC(2016, 8, 9), "2016-W36" ],
[ Date.UTC(2010, 0, 3), "2009-W53" ],
[ Date.UTC(2010, 0, 4), "2010-W01" ],
[ Date.UTC(2010, 0, 10), "2010-W01" ],
[ Date.UTC(2010, 0, 11), "2010-W02" ],
[ 0, "1970-W01" ],
// Maximum valid month (limited by the ecma date object range).
[ 8640000000000000, "275760-W37" ],
// Minimum valid month (limited by the input element minimum valid value).
[ -62135596800000 , "0001-W01" ],
// "Values must be truncated to valid week"
[ 42.1234, "1970-W01" ],
[ 123.123456789123, "1970-W01" ],
[ 1e-1, "1970-W01" ],
[ -1.1, "1970-W01" ],
[ -345600000, "1969-W52" ],
// Negative years, this is out of range for the input element,
// the corresponding week string is the empty string
[ -62135596800001, "" ],
];
element.type = "week";
for (let data of testData) {
element.valueAsDate = new Date(data[0]);
is(element.value, data[1], "valueAsDate should set the value to "
+ data[1]);
element.valueAsDate = new testFrame.Date(data[0]);
is(element.value, data[1], "valueAsDate with other-global date should " + "set the value to " + data[1]);
}
}
// Test <input type='date'>.
checkDateGet();
checkDateSet();
// Test <input type='time'>.
checkTimeGet();
checkTimeSet();
// Test <input type='month'>.
checkMonthGet();
checkMonthSet();
// Test <input type='week'>.
checkWeekGet();
checkWeekSet();
</script>
</pre>
</body>
</html>
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.