Revision be6d3645
Von Sven Schöling vor etwa 7 Jahren hinzugefügt
js/common.js | ||
---|---|---|
121 | 121 |
} |
122 | 122 |
} |
123 | 123 |
|
124 |
function validate_dates(input_name_1, input_name_2) { |
|
125 |
var tempArray1 = new Array(); |
|
126 |
var tempArray2 = new Array(); |
|
127 |
tempArray1 = getDateArray(input_name_1); |
|
128 |
tempArray2 = getDateArray(input_name_2); |
|
129 |
if(check_right_date_format(input_name_1) && check_right_date_format(input_name_2)) { |
|
130 |
if(!((new Date(tempArray2[0], tempArray2[1], tempArray2[2])).getTime() >= (new Date(tempArray1[0], tempArray1[1], tempArray1[2])).getTime())) { |
|
131 |
show_alert_and_focus(input_name_1, wrongDateFormat); |
|
132 |
return show_alert_and_focus(input_name_2, wrongDateFormat); |
|
133 |
} |
|
134 |
if(!((new Date(tempArray2[0], tempArray2[1], tempArray2[2])).getTime() >= (new Date(1900, 1, 1)).getTime())) { |
|
135 |
show_alert_and_focus(input_name_1, wrongDateFormat); |
|
136 |
return show_alert_and_focus(input_name_2, wrongDateFormat); |
|
137 |
} |
|
138 |
} |
|
139 |
} |
|
140 |
|
|
141 |
function getDateArray(input_name) { |
|
142 |
formatArray[2] = input_name.value.substring(dateFormat.indexOf("d"), 2); |
|
143 |
formatArray[1] = input_name.value.substring(dateFormat.indexOf("m"), 2); |
|
144 |
formatArray[0] = input_name.value.substring(dateFormat.indexOf("y"), (dateFormat.length == 10 ? 4 : 2)); |
|
145 |
if(dateFormat.length == 8) { |
|
146 |
formatArray[0] += (formatArray[0] < 70 ? 2000 : 1900); |
|
147 |
} |
|
148 |
return formatArray; |
|
149 |
} |
|
150 |
|
|
151 | 124 |
function show_alert_and_focus(input_name, errorMessage) { |
152 | 125 |
input_name.select(); |
153 | 126 |
alert(errorMessage + "\n\r\n\r--> " + input_name.value); |
Auch abrufbar als: Unified diff
common.js: getDateArray und validate_dates entfernt
Die sind seit 2007 unbenutzt