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
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS[:default]
and
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS[:default]
Changes these values to change DhtmCalendar's formats.
Thanks.
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 -
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.
Great !
Err.. what would be the URL
I usually use ruby/script install <url>
Sorry for asking... :-)
> > > - Show quoted text -- Hide quoted text -
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
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 -
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
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
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
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
Just reinstalled the latest trunk version , works like a charm !
Thanx !
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.