diff --git a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js index 33177d9d0449d86fd8b504c755fee3a7bb88bfe2..943fba51d17574a2812963b89eba42107eb1b942 100644 --- a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js +++ b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js @@ -504,22 +504,16 @@ var Util = new function() { } this.isDateValid = function(dateAsString, isDateOnly) { + var result = {isValid : true}; if (dateAsString) { var timeValueObject = Util.parseDate(dateAsString); if(timeValueObject.getFullYear() !== parseInt(dateAsString.substring(0,4))) { - isValid = false; - error = "Incorrect Date Format. Please follow the format " + (isDateOnly ? 'yyyy-MM-dd (YEAR-MONTH-DAY)' : 'yyyy-MM-dd HH:mm:ss (YEAR-MONTH-DAY : HOUR-MINUTE-SECOND)') + "."; - } else { - isValid = true; + result.isValid = false; + result.error = "Incorrect Date Format. Please follow the format " + (isDateOnly ? 'yyyy-MM-dd (YEAR-MONTH-DAY)' : 'yyyy-MM-dd HH:mm:ss (YEAR-MONTH-DAY : HOUR-MINUTE-SECOND)') + "."; } - - return { - isValid : isValid, - error : error - }; } - return { isValid : true} + return result; } this.getFormatedDate = function(date) {