The second parameter to formatDate needs to be a Date object, you are giving it a string. You may want to try and run the inputs value through parseDate first, although you will have to catch the exceptions it throws with bad input.
On Thu, Oct 8, 2009 at 1:29 PM, Paamayim <[email protected]> wrote: > > Hi. > > I use an input text that on focus shows a datepicker. > > $("#dt").datepicker({ > showOn: "focus", > dateFormat: "yy-mm-dd", > }); > > When I pick a date I want to use it to make some stuff, ajax calls, > etc. I dont use the onSelect event by now because I let the user write > the date by hand, so I have: > > $("#dt").change(function() { > console.log($(this).val()); // debug -> ok > var ts = $.datepicker.formatDate("@", $(this).val() ); > console.log(ts); > // do other stuff > }); > > Now, the ts variable doesn't hold the timestamp of current picked > date, but 0 instead, and I cannot figure out the reason. Is there > anything I'm missing about the $.datepicker.formatDate() function? > > Using latest jquery ui 1.7.2 with jquery 1.3.2, ui core + datepicker. > > Thank you. > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
