Monday 2 April 2018

how to validate date textbox using jquery format as dd MMM yy?

// condition null check
if (rowdata.EffectiveDate != null) {
           // validate format
            var date_regex = /^(([0-9])|([0-2][0-9])|([3][0-1]))\ (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\ \d{2}$/;
            // if different format tha dd MMM yy it will return false
            if (!(date_regex.test(rowdata.EffectiveDate))) {
           
                alert('Please enter valid date!.');
                return;
            }
        }

No comments:

Post a Comment