Skip to content

Instantly share code, notes, and snippets.

@tbuyle
Created January 9, 2012 16:18
Show Gist options
  • Save tbuyle/1583642 to your computer and use it in GitHub Desktop.
Save tbuyle/1583642 to your computer and use it in GitHub Desktop.
Formtastic Datepicker field.
$(function() {
$("INPUT.datepicker").datepicker();
}
class DatepickerInput < Formtastic::Inputs::StringInput
def input_html_options
unless object.nil?
value = I18n.l(object.send(method))
else
value =""
end
super.merge(:class => "#{super[:class]} datepicker", :value => value)
end
end
@tbuyle
Copy link
Author

tbuyle commented Jan 9, 2012

Formtastic Custom Input for Jquery UI datepicker.
The input will have the datepicker class an display the date with localised format. (you may have to change $.datepicker default to match your date format)

@cue232s
Copy link

cue232s commented Jan 31, 2013

how do I use this in a rails application?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment