Is there an easy way to format the display of a DateTime
value in a Rails view?
For example, if I\'m doing something like:
<%= text_field
Some great suggestions here, however in those cases where you really do want your text field date formatted a specific way (say you're integrating with a javascript date picker), and you're dealing with nils, I think simply making a minor tweak to your existing method would do the trick:
:value => (@object.start_date.blank? ? '' : @object.start_date.strftime('%m/%d/%Y'))