javascript - jquery ui datepicker, reverse format date -
i have datepicker displays months , years.. months in literal form (march, april etc).
when click on date picker , value in text field "march 2014" datepicker displays current month (june) instead. datepicker cant parse date in literal format. i'm trying reverse parse before datepicker shows.. not working. example:
var monthselect = $('#monthselect').datepicker({ changemonth: true, changeyear: true, showbuttonpanel: true, dateformat: 'mm yy', beforeshow: function(){ var months = { 'january' : '01', 'february' : '02', 'march' : '03', 'april' : '04', 'may' : '05', 'june' : '06', 'july' : '07', 'august' : '08', 'september' : '09', 'october' : '10', 'november' : '11', 'december' : '12'}; var thisval = $(this).val().split(' '); var numericmonth = months[thisval[0]]; var numericyear = thisval[1]; $(this).datepicker('setdate', numericmonth + '/01/' + numericyear); // $(this).val(numericmonth + '/01/' + numericyear); },
is there way "unformat" date? i'm sure there must cant seem find correct way
look @ fiddle.. can date stick?
Comments
Post a Comment