Bug 17524: Fix datepicker check for iso dates

Iso dates are yyyy-mm-dd, the is_valid JS function
expects \d{2}-\d{2}-\d{4} when it should be \d{4}-\d{2}-\d{2}

Test plan:
Switch DateFormat to iso
Set a due date using the datepicker
=> Should work as expected

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 23f4830095)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
This commit is contained in:
Jonathan Druart 2016-10-31 14:40:51 +00:00 committed by Frédéric Demians
parent a2d0b69bf6
commit 0e28efe9ee
1 changed files with 1 additions and 1 deletions

View File

@ -20,7 +20,7 @@ function is_valid_date(date) {
if ( date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1 ) return 0;
dateformat = 'dd/mm/yy';
} else if (dateformat == 'iso' ) {
if ( date.search(/^\d{2}-\d{2}-\d{4}($|\s)/) == -1 ) return 0;
if ( date.search(/^\d{4}-\d{2}-\d{2}($|\s)/) == -1 ) return 0;
dateformat = 'yy-mm-dd';
} else if ( dateformat == 'dmydot' ) {
if ( date.search(/^\d{2}\.\d{2}\.\d{4}($|\s)/) == -1 ) return 0;