Reputation: 37
I am using the following code, however, the $.datepicker.parseDate method fails to parse 20140906
when I specify the format yyMMdd
. How to parse this format in date picker?
function setValueDateRange(){
if($("#businessDate").val()!=null && $("#businessDate").val()!='' && $("#businessDate").val()!='undefined'){
var tillDateMin = $.datepicker.parseDate(GLOBAL_DATE_FORMAT, $("#businessDate").val());
tillDateMin.setDate(tillDateMin.getDate()+3);
$("#paymentValueDateBatch").datepicker( "option", "minDate", tillDateMin);
}
}
// GLOBAL_DATE_FORMAT-> yyMMdd
// $("#businessDate").val()->20140906
Upvotes: 1
Views: 7377
Reputation: 318302
$.datepicker.parseDate
parses a string, and returns a date object. Note that the date format in the first argument tells parseDate how to parse the given date etc.
You're using yyMMdd
, so it expects a date given like this
$.datepicker.parseDate('yyMMdd', '2014september06');
The month formats are as follows
Here's some valid examples
$.datepicker.parseDate('yymmdd', '20140906');
$.datepicker.parseDate('dd/mm/yy', '06/09/2014');
Upvotes: 6