Date Format - Howto?

19 views
Skip to first unread message

haillatu

unread,
Aug 24, 2007, 12:20:38 PM8/24/07
to Ruby on Rails: DHTML Calendar
Hello,

I am trying to change the date format from the default to %d-%m-%Y. I
have
<p><label for="item_watch_start_date">Watch Start Date</label><br/>
<%= calendar_box 'item', 'watch_start_date', {:class => 'date'},
{ :ifFormat => "%d-%m-%Y", :daFormat => "%d-%m-%Y"
}
%>

But that doesn't do anything. It still displays in the default format.
Any ideas how I can get the text field to display in %d-%m-%Y format?

Thanks,
vps

Ed Moss

unread,
Sep 20, 2007, 3:34:29 PM9/20/07
to Ruby on Rails: DHTML Calendar
Format is controlled via:

ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS[:default]

and

ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS[:default]

Changes these values to change DhtmCalendar's formats.

Thanks.

haillatu

unread,
Sep 25, 2007, 5:06:30 PM9/25/07
to Ruby on Rails: DHTML Calendar
Excellent! Thanks much.

CCH

unread,
Sep 25, 2007, 7:58:35 PM9/25/07
to Ruby on Rails: DHTML Calendar
Hi Hailatu

I am sure that the dates displayed would be OK but have you tried edit/
create and then check if the dates are saved ?

> > > vps- Hide quoted text -
>
> - Show quoted text -

haillatu

unread,
Sep 26, 2007, 11:57:36 AM9/26/07
to Ruby on Rails: DHTML Calendar
Hi CCH,

Yes, it works fine.

But another question. I want the calendar box to initialize with a
default value of say '01-01-2007'.

I tried these
A)
<%= calendar_box 'item', 'watch_start_date', {:class => 'date', :value
=> '01-01-2007'} %>
B)
<%= calendar_box 'item', 'watch_start_date', {:class => 'date'},{:date
=> '01-01-2007'} %>

But neither of them display anything in the text field. Any ideas what
I am doing wrong.

Thanks,
vps

On Sep 25, 7:58 pm, CCH <c...@karensoft.com.my> wrote:
> Hi Hailatu
>
> I am sure that the dates displayed would be OK but have you tried edit/
> create and then check if the dates are saved ?
>
> On Sep 26, 5:06 am, haillatu <vpsh...@gmail.com> wrote:
>
> > Excellent! Thanks much.
>
> > On Sep 20, 3:34 pm, Ed Moss <edwin.m...@gmail.com> wrote:
>
> > > Format is controlled via:
>
> > > ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS[:default]
>
> > > and
>
> > > ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS[:default]
>
> > > Changes these values to change DhtmCalendar's formats.
>
> > > Thanks.
> > > On Aug 24, 10:20 am, haillatu <vpsh...@gmail.com> wrote:
>
> > > > Hello,
>

> > > > I am trying to change thedateformat from thedefaultto %d-%m-%Y. I
> > > > have
> > > > <p><label for="item_watch_start_date">Watch StartDate</label><br/>

Reply all
Reply to author
Forward
0 new messages