Change Format using Javascript call

4 views
Skip to first unread message

Hussain Sulais

unread,
Jun 28, 2009, 6:37:59 PM6/28/09
to calendar_date_select
Hello,

I have been using the library as is for a while, it works smoothly.

Now, I need formatting to change and match ISO or European format.
Since am not using RoR, I have not found a way to do the changes
without RB environment changes..

can someone help in this matter, how can the change be made using
Javascript calls or Prototype OPTIONS parameters..


thanks

Hussain

Kresimir Bojcic

unread,
Jun 28, 2009, 11:45:41 PM6/28/09
to calendar_d...@googlegroups.com

H.A.S

unread,
Jun 29, 2009, 12:36:25 AM6/29/09
to calendar_d...@googlegroups.com
Thanks Kresimi.

and for others who might ask how it is being done,
It is simply done by making a js file with code to override the method in the original responsible for formatting..
(which I actually modified instead of creating a separate file)..

then the order of file include is
<script type="text/javascript" language="javascript" src="scripts/calendar_date_select/calendar_date_select.js"></script>
<script type="text/javascript" language="javascript" src="scripts/calendar_date_select/format_iso.js"></script>

and that's it.


for my purpose, I have added this method:
Date.zeroTrail = function(x){r = (x.toString().length>1) ? x:"0"+x;return r;}

it will ensure the date is two digits [01,02,03...,10,11, etc]

and of course used it on the line for displaying the date
str = Date.zeroTrail(this.getDate()) + "/" + Date.zeroTrail((this.getMonth() + 1)) + "/" + this.getFullYear();

hope someone will find it useful.

thanks again for the fast reply.

Hussain


From: Kresimir Bojcic <kresimi...@gmail.com>
To: calendar_d...@googlegroups.com
Sent: Sunday, June 28, 2009 10:45:41 PM
Subject: Re: Change Format using Javascript call
Reply all
Reply to author
Forward
0 new messages