Forums

DatePicker calender shows wrong default date( January 1970)

Tobeass 21 Dec, 2012
Hi,

I am using the mootool DatePicker and it works fine when I enter a date in the imput field. But when I try to chance the input the Calender does not show the current date any longer. Instead of that it shows january 1970. How can I fix it? Is it possible to clear the imput field before entering a new date?

I am using:
chronoforms 4.0 RC3.5.2 and joomla 2.5.8
DateTime Picker Config:
format:'%d.%m.%Y | %H:%M Uhr'

DatePicker type: Mootools DatePicker
MooDate Picker Style: JQUI

The following Load JS Event is in use:
 <?php
    $lang =& JFactory::getLanguage();
    $tag = $lang->getTag();
    echo "Locale.use('de-DE');";
    ?>


I hope someone can help me.
GreyHead 21 Dec, 2012
Hi Tobeass,

1 Jan 1970 is the default date - usually you see that when the date is empty or set to 0000-00-00

Please post a link to the form so I can take a quick look.

Bob
Tobeass 21 Dec, 2012
Thanks. I sent a pm to you.
GreyHead 21 Dec, 2012
Hi Tobeass,

There's something odd - It looks as though somehow you have two formats set for the datetime picker.
new Picker.Date($$('.cf_datetime_picker'), {
pickerClass: 'datepicker_jqui', format: '%d-%m-%Y %H:%M:%S', timePicker: true, allowEmpty: true, useFadeInOut: !Browser.ie, format:'%d.%m.%Y | %H:%M Uhr'
}); 
You might need to change the class to stop this happening.

But I think that the problem is that you have set a format with the | and Uhr that the DatePicker can't read (its pretty good with most common formats) and so it assumes that no date is set and defaults back to 1/1/1970.

Bob
Tobeass 21 Dec, 2012
Thanks,
that modification lead to a solution. But is there a possibility to keep the string 'Uhr' in the output.

And how can the past dates blocked in the mootool calender so that users can just choose future dates or the current date?

Regards

Tobi
GreyHead 22 Dec, 2012
Hi Tobi,

Not simple to add the 'Uhr' :-( You could insert it after the input box with a little JavaScript, or add it after the form is submitted if that is where you need it. Or you could write a new Date Parser that can handle it.

There's a minDate option that you can use to set the minimum date. See this post

Bob
This topic is locked and no more replies can be posted.