Monday, October 18, 2021

OIC - validate date format as MM-DD-YYYY

I use this regex for validating MM-DD-YYYY:

function isValidDate(subject){
  if (subject.match(/^(?:(0[1-9]|1[012])[\- \/.](0[1-9]|[12][0-9]|3[01])[\- \/.](19|20)[0-9]{2})$/)){
    return true;
  }else{
    return false;
  }
}

It will match only valid months and you can use / - or . as separators.

No comments:

Post a Comment

Featured Post

OIC - Commonly Used XSLT Functions in Oracle Integration Cloud (OIC)

In Oracle Integration Cloud (OIC), the most commonly used XSLT functions are primarily focused on transforming, filtering, and manipulating ...