Check date format and display warning on the failing fields
This commit is contained in:
parent
4cf28bf8f6
commit
44c24493b6
@ -52,6 +52,10 @@ $(document).ready(function () {
|
||||
var dtsplit = dateStr.split(/[\/ .:-]/);
|
||||
var dfsplit = format.split(/[\/ .:-]/);
|
||||
|
||||
if (dfsplit.length != dtsplit.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// creates assoc array for date
|
||||
var df = [];
|
||||
for (var dc = 0; dc < dtsplit.length; dc++) {
|
||||
@ -239,6 +243,7 @@ $(document).ready(function () {
|
||||
|
||||
// console.log('start_date as date', startDate);
|
||||
// console.log('start_end as date', endDate);
|
||||
if (startDate != null && endDate != null) {
|
||||
if (startDate <= endDate) {
|
||||
while (startDate <= endDate) {
|
||||
var dateStr = formatDate(startDate, window.date_formats.DATE);
|
||||
@ -258,7 +263,17 @@ $(document).ready(function () {
|
||||
setTimeout(function () {
|
||||
startDateField.parent().addClass('has-error');
|
||||
endDateField.parent().addClass('has-error');
|
||||
}, 200);
|
||||
|
||||
}
|
||||
} else {
|
||||
setTimeout(function () {
|
||||
if (startDate == null) {
|
||||
startDateField.parent().addClass('has-error');
|
||||
}
|
||||
if (endDate == null) {
|
||||
endDateField.parent().addClass('has-error');
|
||||
}
|
||||
}, 200);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user