X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/ccfd9aace3d2c0a1199668e36d2deadbb871bd9b..11532af81ab15de7b9bb68d40216c3886c194b3f:/js/kivi.js diff --git a/js/kivi.js b/js/kivi.js index 8e190020f..3ee73a708 100644 --- a/js/kivi.js +++ b/js/kivi.js @@ -37,6 +37,9 @@ namespace("kivi", function(ns) { if (date === '') return null; + if (date === '0' || date === '00') + return new Date(); + var parts = date.replace(/\s+/g, "").split(ns._date_format.sep); var today = new Date(); @@ -65,19 +68,21 @@ namespace("kivi", function(ns) { if (parts.length == 3) { var year = +parts[ ns._date_format.y ] || 0 * 1 || (new Date()).getFullYear(); + if (year > 9999) + return undefined; if (year < 100) { year += year > 70 ? 1900 : 2000; } date = new Date( year, - (parts[ ns._date_format.m ] || 0) * 1 - 1, // Months are 0-based. - (parts[ ns._date_format.d ] || 0) * 1 + (parts[ ns._date_format.m ] || (today.getMonth() + 1)) * 1 - 1, // Months are 0-based. + (parts[ ns._date_format.d ] || today.getDate()) * 1 ); } else if (parts.length == 2) { date = new Date( (new Date()).getFullYear(), - (parts[ (ns._date_format.m > ns._date_format.d) * 1 ] || 0) * 1 - 1, // Months are 0-based. - (parts[ (ns._date_format.d > ns._date_format.m) * 1 ] || 0) * 1 + (parts[ (ns._date_format.m > ns._date_format.d) * 1 ] || (today.getMonth() + 1)) * 1 - 1, // Months are 0-based. + (parts[ (ns._date_format.d > ns._date_format.m) * 1 ] || today.getDate()) * 1 ); } else return undefined; @@ -363,8 +368,8 @@ namespace("kivi", function(ns) { }; // Return a function object by its name (a string). Works both with - // global functions (e.g. "check_right_date_format") and those in - // namespaces (e.g. "kivi.t8"). + // global functions (e.g. "focus_by_name") and those in namespaces (e.g. + // "kivi.t8"). // Returns null if the object is not found. ns.get_function_by_name = function(name) { var parts = name.match("(.+)\\.([^\\.]+)$"); @@ -513,7 +518,7 @@ namespace("kivi", function(ns) { if (!kivi.Validator) { console.log('kivi.Validator is not loaded'); } else { - kivi.Validator.validate_all(selector); + return kivi.Validator.validate_all(selector); } };