Greetings!
Can anyone tell me how to use just a normal input field as a date
entry? I can use a text_field tag, but that brings the date out in
CCYY-MM-DD format. I would like to be able to simply key in my dates
like mm/dd/ccyy format.
Thanks,
Jeremy
Jeremy I suggest you check out magicdate
http://simon.incutio.com/archive/2003/10/06/betterDateInput
it will handle most common date formats, plus others like ‘tomorrow’,
‘last monday’, ‘next friday’.
For nice packaging, you can check out Nathaniel’s dateboxengine (uses
the magicdate js) but (last time I checked) only allows one date box
per page.
http://www.agilewebdevelopment.com/plugins/datebox_engine
Jodi
On 6/14/06, Jeremy C. [email protected] wrote:
Can anyone tell me how to use just a normal input field as a date
entry? I can use a text_field tag, but that brings the date out in
CCYY-MM-DD format. I would like to be able to simply key in my dates
like mm/dd/ccyy format.
The Simple Date Select plugin [1] uses text boxes instead of select
boxes, but displays in ISO 8601 time (YYYY-MM-DD). You can key in
MM/DD/YYYY if you want (also MM/DD/YY and MM/DD). Modifying the
plugin to display in MM/DD/YYYY format should be fairly easy
(following untested):
def to_date_select_tag(options = {})
to_input_field_tag('text', {'size'=>'10',
‘value’=>value.strftime(‘%m/%d/%Y’)}.merge(options))
end
[1] http://wiki.rubyonrails.org/rails/pages/Simple+Date+Select+Plugin