Bug 14060: Force leading zeros on date
If a date does not contain leading zeros for day and month, the date will be refused. parseDate function considers 1/1/1990 as a valid date, but our perl code does not. We must refuse it. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
26fdc96c5e
commit
db3df548b6
|
|
@ -11,17 +11,17 @@ var MSG_PLEASE_ENTER_A_VALID_DATE = _("Please enter a valid date (should match %
|
|||
function is_valid_date(date) {
|
||||
var dateformat = dateformat_str = '[% Koha.Preference('dateformat') %]';
|
||||
if ( dateformat == 'us' ) {
|
||||
if ( date.search(/\d{2}\/\d{2}\/\d{4}/) == -1 ) return 0;
|
||||
dateformat = 'mm/dd/yy';
|
||||
dateformat_str = 'mm/dd/yyyy';
|
||||
} else if ( dateformat == 'metric' ) {
|
||||
if ( date.search(/\d{2}\/\d{2}\/\d{4}/) == -1 ) return 0;
|
||||
dateformat = 'dd/mm/yy';
|
||||
dateformat_str = 'dd/mm/yyyy';
|
||||
} else if (dateformat == 'iso' ) {
|
||||
if ( date.search(/\d{2}-\d{2}-\d{4}/) == -1 ) return 0;
|
||||
dateformat = 'yy-mm-dd';
|
||||
dateformat_str = 'yyyy-mm-dd';
|
||||
} else if ( dateformat == 'dmydot' ) {
|
||||
if ( date.search(/\d{2}\.\d{2}\.\d{4}/) == -1 ) return 0;
|
||||
dateformat = 'dd.mm.yy';
|
||||
dateformat_str = 'dd.mm.yyyy';
|
||||
}
|
||||
try {
|
||||
$.datepicker.parseDate(dateformat, date);
|
||||
|
|
|
|||
Loading…
Reference in New Issue