Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Jquery Date Picker Validation - format issue

RDMar 2 2010 — edited Mar 2 2010
Hi ,

I am using 2 text items with Jquery dateicker for start date and end date items.

I have to now write a JS validation to ensure start date <= end date.

The dateformat of my items are 'd-M-yy' (02-Mar-2010) .....

When I try to use the Date.parse() function , it gives me an invalid date error....
If I change the date format to mm/dd/yy (03/02/2010) then there is no problem, I can use Date.parse() and compare the two dates, I get no error . However I need the date format to be : 02-Mar-2010

Below is a simple version of the JS function Iam using to compare dates and alert error
function f_validate()
{
var a = $v('P1_START_DATE');
var b = $v('P1_END_DATE');

var startDate = new Date();
var endDate = new Date();

startDate = Date.parse(a);
endDate = Date.parse(b);
// if I alert() startDate or endDate it says invalid date
if (startDate>endDate){
alert('error');
else
{
doSubmit();
}
}



} 
Has anybody done a similar validation with Jquery datepickers in the format 'd-M-yy' ?
Also how Can I use $.datepicker.parseDate function within my Javascript function so that I can convert the dates to the default format and then compare them....
Appreciate any ideas/pointers


Thanks,
Dippy

Edited by: Dippy on Mar 2, 2010 12:42 AM
This post has been answered by Andy Hardy on Mar 2 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 30 2010
Added on Mar 2 2010
2 comments
1,993 views