Project

General

Profile

Defect #524

Date.parseExact(String, Array) doesn't work properly

Added by Robert Ivens almost 12 years ago.

Status:
New
Priority:
Normal
Assignee:
Start date:
07/05/2012
Due date:
% Done:

0%

Estimated time:
Browser (if web client):

Description

If the dateString passed is '6/28/2012', the function below returns null

function UTIL_isDate2(dateString) {
   var result_D = null;
   if(dateString) {
      result_D = Date.parseExact(dateString, [
         'M.d.yy', 'M.d.yyyy', 
         'M/d/yy', 'M/d/yyyy', 
         'M-d-yy', 'M-d-yyyy', 
         'M.dd.yy', 'M.dd.yyyy', 
         'M/dd/yy', 'M/dd/yyyy', 
         'M-dd-yy', 'M-dd-yyyy',
         'MM.d.yy', 'MM.d.yyyy', 
         'MM/d/yy', 'MM/d/yyyy', 
         'MM-d-yy', 'MM-d-yyyy', 
         'MM.dd.yy', 'MM.dd.yyyy', 
         'MM/dd/yy', 'MM/dd/yyyy', 
         'MM-dd-yy', 'MM-dd-yyyy', 
         'yyyy-M-d', 'yyyy-MM-d', 'yyyy-M-dd', 'yyyy-MM-dd'])
   }
   return result_D;
}

It seems that if the first format matches the datastring then it does work, but not when the format is second or further in the array

Also available in: Atom PDF