thank you.. i'll use the inst value as you recommend. but just a note... I did not set the dateFormat so why is it different on other machines?
another note: the inst.selectedMonth is zero based indexed? is this a bug or as designed? days and year are not zero based indexed? regards, Peter On Tue, Jun 16, 2009 at 7:39 AM, Ca-Phun Ung <[email protected]> wrote: > Hi, > > The dateText returned depends on the dateFormat option. So if you specified > a dateFormat="dd/mm/yy" you will have to split by "/". > > The onSelect event also returns an instance of the datepicker, so something > like this is probably more accurate: > > ... > > onSelect: function(dateText, inst) { > var year = inst.selectedYear; > var month = inst.selectedMonth; > var day = inst.selectedDay; > > .... > > > > On Tue, Jun 16, 2009 at 2:13 AM, Peter Marino <[email protected]>wrote: > >> Hi jQuery UI, >> I use the following: >> >> $("input.date").datepicker( >> { >> showOn: 'button', >> buttonImage: '../images/cal.png', >> buttonImageOnly: true, >> onSelect: function (dateText) >> { >> var arr_dateText = dateText.split("-"); >> >> var day = arr_dateText[0]; >> var month = arr_dateText[1]; >> var year = arr_dateText[2]; >> $(this).siblings( ".day" ).attr( "value", day ).css( "color", "black" >> ).css( "font-style", "normal" ); >> $(this).siblings( ".month" ).attr( "value", month ).css( "color", >> "black" ).css( "font-style", "normal" ); >> $(this).siblings( ".year" ).attr( "value", year ).css( "color", "black" >> ).css( "font-style", "normal" ); >> } >> }); >> >> >> this works great and splits the date into day, month, year... only problem >> is that on other computers it is not always seperated with a "-" but with >> other >> characters.. is there a proper way to split the dateText? >> >> regards, >> Peter >> >> -- >> Power Tumbling - http://www.powertumbling.dk >> OSG-Help - http://osghelp.com >> >> >> > > > -- > Ca-Phun Ung > + http://yelotofu.com > + hongkong, zce, jquery, jqueryui, php, css, html > > > > -- Power Tumbling - http://www.powertumbling.dk OSG-Help - http://osghelp.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~---
