You can pass special strings into jQuery's Datepicker class setDate() method like "+7" which will be translated into "7 days from today":
http://docs.jquery.com/UI/Datepicker#method-setDate
But you can't get that "+7" back out. When you call getDate() you get the calculated resulting date.
I have a use case where I need to pull out the special string "+7" for propagation. One chunk of code is passing a special string into the Datepicker and passing the Datepicker over to another chunk of code which pulls out the date, but the latter sometimes needs to know the special string rather than the calculated date.
So I need to enhance the Datepicker tool to (a) store the special code internally and (b) expose it via a method like getOriginallyPassedInDate() or some such.
I'm not a jQuery/Javascript ninja so I could really use some guidance on how I might preferably-unobtrusively add the necessary functionality to the Datepicker class, the way you might monkey-patch an object in Ruby I'm guessing.
Check out Paul Irish's post on Duck Punching with Jquery
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With