[EventCalendar] localization of jscalendar

Alex Tingle alex at firetree.net
Wed Dec 10 16:34:55 UTC 2008


Hi Rolf,

Rolf Ohl wrote:
>>> When I pick a date from jscalendar, I get an english notation in  
>>> the input
>>> field. e.g. 2008-12-10 11:00
>>

Alex Tingle write:
>> That's not "English" notation, it's ISO standard notation (ISO  
>> 8601). You
>> can't localise it, because it's the same in every locale.

Rolf Ohl wrote:
> Thank you Alex.
>
> Letme refine my problem:
> When I pick a date from jscalendar, I get an ugly ISO notation in an  
> input
> field, e.g. 2008-12-10 11:00  which certainly will confuse most of the
> (german) users of my site.
>
> What I'd prefer is a notation they are more more familiar with.
>
> As far as I can see, this means:
> 1. calling Calendar.setup with e.g.
> ifFormat : "%d.%m.%Y%I:%M"
> 2. Implementing a filter which converts the value of the date input  
> field
> into ISO notation whenever that date is read by ec3 to store it in the
> database.
> 3. Implementing another filter which converts the values from the  
> database
> into the new "custom notation" whenever ec3 populates a date input  
> field for
> jscalendar.
>
> Writing the filters wouldn't be that much a problem. Where I'm lost  
> is where
> exactly (and maybe how) in the source code of ec3 one could provide  
> the
> hooks for these filters.

OK, I take your point.

The best approach would be to confine yourself entirely to the  
Javascript. The PHP could generate the page with ISO format dates,  
then JS translates them to <whatever> for display, then JS translates  
them back to ISO again before sending the form to the web-server.

That's easier than trying to change the PHP as well - you would have  
to ensure that the PHP and JS were synchronised, and that would never  
work reliably.

If you want to have a go at the Javascript, I can put some hooks in it  
for you. Interested?

-Alex





More information about the EventCalendar mailing list