german date format

12 views
Skip to first unread message

j--c

unread,
Sep 9, 2007, 6:53:10 AM9/9/07
to Ruby on Rails: DHTML Calendar
Hi,

I tried to convince the dhtm calendar to show german date format in a
box calendar, but had no luck at all. It works if I use the original
javascript calendar, but not with the plugin.

Here is my last try with a callback function:

<div><label for="change_advance_booking">Verkauf beginnt</
label>
<%= calendar_box 'production', 'date_advance_booking',
{ :class => 'date',
:button_image => 'calendar.gif',
:button_title => 'Datum auswählen' },
{ :firstDay => 1,
:onUpdate => 'dateChanged',
:weekNumbers => false,
:range => [Time.now.year, Time.now.year+3],
:step => 1,
:showOthers => false,
:cache => true } %></div>

<script type="text/javascript">
//<![CDATA[
function dateChanged(calendar) {
alert("hi i was there"); // just say hello to see if the callback has
been called
// OK, a date was clicked, setup correct local date format
Y = calendar.date.getFullYear();
m = calendar.date.getMonth() + 1; // integer, 0..11
d = calendar.date.getDate(); // integer, 1..31
document.forms[0].production_date_advance_booking.value = d + "."
+ m + "." + Y
};
//]]>
</script>


Any help would really be appreciated. Thanks
John

Ed Moss

unread,
Sep 20, 2007, 3:36:30 PM9/20/07
to Ruby on Rails: DHTML Calendar
Have you tried changing:

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

and

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

Changes these values to change DhtmCalendar's formats.

Thanks.

CCH

unread,
Sep 23, 2007, 5:07:31 AM9/23/07
to Ruby on Rails: DHTML Calendar
Hi Ed

Our Malaysian date format ie dd/mm/yyyy is the same as the german
format
Your solution works great as in list/create/update/show, I get the
desire dd/mm/yyyy format.

However, in create/edit, I am never able to save any dates ie saved as
empty as MySQL default format is yyyy-mm-dd

Any further guidance is appreciated.

> > John- Hide quoted text -
>
> - Show quoted text -

Ed Moss

unread,
Sep 26, 2007, 10:35:49 AM9/26/07
to Ruby on Rails: DHTML Calendar
Please try trunk revision 62:

Renamed localize_date_format to dhtml_db_date_format.

Reworked date_cast logic.

Fixed Quoting to treat Date the same as Time and DateTime.

Hopefully, this works as documented now.

CCH

unread,
Sep 26, 2007, 10:44:34 AM9/26/07
to Ruby on Rails: DHTML Calendar
Hi Ed Moss

Great !

Err.. what would be the URL
I usually use ruby/script install <url>

Sorry for asking... :-)

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

Ed Moss

unread,
Sep 27, 2007, 10:39:50 AM9/27/07
to Ruby on Rails: DHTML Calendar

CCH

unread,
Sep 28, 2007, 1:04:25 AM9/28/07
to Ruby on Rails: DHTML Calendar
Hi Ed


On Sep 27, 10:39 pm, Ed Moss <edwin.m...@gmail.com> wrote:
> https://dhtml-calendar.googlecode.com/svn/trunk

cch: Plugin not found
But this works
http://dhtml-calendar.googlecode.com/svn/trunk

CCH

unread,
Sep 28, 2007, 1:25:24 AM9/28/07
to Ruby on Rails: DHTML Calendar
Hi Ed

Just downloaded from trunk

1) I added to a controller


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

='%d/%m/%Y'


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

='%d/%m/%Y %H:%M'
ActiveRecord::Base.dhtml_db_date_format = '%Y-%m-%d'

Obsevationst :
1) No crashes as reported earlier
2) display formats OK as dd/mm/yyyy
3) I changed a date from 29/09/07 to 11/09/2007
result : on saving, list shows saved as 09/11/2007
Click edit confirms that it was saves as 09/11/2007 ie 9th Nov
2007 !!!

4. Changed date to 09/08/2007 ie 9th sept, 2007
On saving, I now get an empty date <sigh>

What do I do next ?

On Sep 26, 10:35 pm, Ed Moss <edwin.m...@gmail.com> wrote:

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

CCH

unread,
Oct 1, 2007, 1:33:05 AM10/1/07
to Ruby on Rails: DHTML Calendar
Hi Ed

I retested this morning as follows :-

1. Added to environment.rb



ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS[:default]
='%d/%m/%Y'

ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS[:default]
='%d/%m/%Y %H:%M'

2. Removed all date-related helpers

Result :
1) Except for 1 controller, all dates are nowdisplayed correctly as dd/
mm/yyyy in list/edit/create :-)
2) In one of the controller,
a) created a new row, click on dhtml-calendar and selected 1/10/2007
ie 1st Oct 2007
and it appears as 1/10/2007 in thetext box

b)On saving,the list shows 10/1/2007 ie 10th January 2007 !

FYI,the codes are as follows :-
class DisbursementsController < ApplicationController
layout 'finance_menu'
cache_sweeper :audit_sweeper

active_scaffold :disbursement do |config|
config.label ="Disbursements"
config.columns = [:claim_date,
:staff,
:customer,
:expense,
:claim_amount,
:remarks,
:created_by,:created_at,:updated_by,:updated_at]


list.columns.exclude :remarks, :created_by,:created_at,:updated_by,:updated_at

create.columns.exclude :created_by,:created_at,:updated_by,:updated_at

update.columns.exclude :created_by,:created_at,:updated_by,:updated_at

list.sorting = [{:claim_date => 'DESC'}]

config.columns[:claim_date].form_ui = :calendar

end
end

Can you clue me in as to why 2(a) and(b) is happening ...

TQ

Open individual

unread,
Oct 4, 2007, 9:03:52 AM10/4/07
to Ruby on Rails: DHTML Calendar
Hi everyone in the forum.

I am having major issues trying to get the DHTML calendar to work with
PostgreSQL.

http://groups.google.com/group/activescaffold/browse_thread/thread/a37ea7d7dfa46a68

I really hope that this is something small but after spending the
entire day on it I think it is almost impossible.

Are there any PostgreSQL users out there taht have got DHTML calendar
to work.

Thanks
Uncle Mike

Kanniball

unread,
Oct 4, 2007, 9:08:54 AM10/4/07
to dhtml-c...@googlegroups.com
I use it with postgresql and found no problem so far.
What are the type of the column you are inserting the result?
Are you using migrations to create the database?

Regars,

Paulo Fidalgo

Open individual

unread,
Oct 4, 2007, 9:41:47 AM10/4/07
to Ruby on Rails: DHTML Calendar
Thanks Kanniball for the reply,

I really appreciate it.

>What are the type of the column you are inserting the result?

If I look at the birthdate column it says "date" as datatype, not
timestamp or time or anything else.
I am using ActiveScaffold with the latest trunk downloaded on the 4
October 2007

>Are you using migrations to create the database?

Yes I am using migrations to build the DB

Here is a snippet

create_table :customers do |t|
t.column :firstname, :string, :limit => 50
t.column :lastname, :string, :limit => 50
t.column :birthdate, :date

Are you using ActiveScaffold?
If so what trunk version are you using?

How could I get this older trunk version?

Thanks you for you help and time Paulo

Open individual

unread,
Oct 5, 2007, 2:30:04 AM10/5/07
to Ruby on Rails: DHTML Calendar
Not to stress.

Ed fixed this issue in record time and got me going again.

There are a so many PostGreSQL DB users out there so if you are one of
them you will be pleased to hear that Ed Moss has got it working.
It is working 100% now in my Active Scaffold integration.

Thanks Ed.

Uncle Mike

CCH

unread,
Oct 5, 2007, 6:41:56 AM10/5/07
to Ruby on Rails: DHTML Calendar
Hi Ed

Just reinstalled the latest trunk version , works like a charm !

Thanx !

Open individual

unread,
Oct 8, 2007, 4:47:43 AM10/8/07
to Ruby on Rails: DHTML Calendar
Hi CCH,

We seem to be thinking in the same direction.

I have posted a new topic in this discussion concerning date
validation.

As right now I can't get it working with Active Scaffold.

Has anyone got this working or approaches it in a different way?

I have been stuck the whole weekend on this issue.

I will make a new post called "Date and/or Time validation"

I had a look at Ed Moss's great Demo.

He has the same concept that I and the rest of the developers out
there would like to do.

I see he has a similar problem with date/time validation as I am still
able to enter in text and select the create button.

Check the "Date and/or Time validation" post to follow the progress.

Reply all
Reply to author
Forward
0 new messages