Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Blog Module /

Discuss the Blog Module.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Invalid Time Format

Go to End

8 Posts   2379 Views

Shauna G

Community Member, 52 Posts

8 July 2010 at 1:58pm

I just installed 2.4 with the blog module (fresh download of both on July 5) and ran into some issues when I went to change the blog's entry date. When I select a date using the date picker, it shows up in dd/mm/yyyy format and fails validation (expects mm/dd/yyyy).

I looked in the forums and found Mo's entry from about a month ago. It talked about adding the locale setting and used en_NZ, so I figured I'd try setting it to en_NZ (locale setting already existed and was the default en_US, which would be my locale, anyway), but it didn't help. It also mentioned a bug report, which I followed and found a revised version of the DatetimeField file. I downloaded the latest copy of the file and replaced my copy of the file, but it didn't work, either (though it did give me a slightly more useful error than the generic "Javascript error"), AND it triggered a somewhat interesting behavior - with the new code in DatetimeField and nothing else, when I opened the date picker, it defaulted to Sept 7, 2011 (I have no clue where it got that date from).

Has anyone found a way to fix or get around the main issue (wrong date format)? I think it might be minor for me at this point, since I shouldn't be backdating anymore entries, but it'd be nice to be able to use the date picker tool to select the date that I want and have it validate properly on the occasions that I would be selecting a new date. Also, it might help others who are also having trouble and the solutions in the other thread aren't working.


Community Member, 128 Posts

16 July 2010 at 8:00am

Edited: 16/07/2010 8:02am


I have the same issue.

I use the date picker and choose, say...May 8, 2010. (05/08/2010)

After saving the page the date shows as August 5, 2010. (08/05/2010)

Any thoughts?


EDIT: Or how to disable the date-picker tool?


Community Member, 128 Posts

29 July 2010 at 9:15am

I think this needs a bug report filed? Or documentation?


Shauna G

Community Member, 52 Posts

3 August 2010 at 6:20am

I've filed a bug report for it. It can be found here:


Community Member, 34 Posts

24 November 2010 at 10:01am

I added the following line to BlogEntry.php under line 86 and works fine:

$dateField->getDateField()->setConfig('dateformat', 'dd/MM/YYYY');

Now looks like:

$fields->addFieldToTab("Root.Content.Main", $dateField = new DatetimeField("Date", _t("BlogEntry.DT", "Date")),"Content");
$dateField->getDateField()->setConfig('showcalendar', true);
$dateField->getTimeField()->setConfig('showdropdown', true);
$dateField->getDateField()->setConfig('dateformat', 'dd/MM/YYYY');


Community Member, 6 Posts

4 January 2011 at 1:47am

Edited: 04/01/2011 1:55am

Hi everybody ! Happy new year !

IHMO this is a critical bug : if you download the module, you just CAN'T create any blog entry.
Module is supposed to be maintain by silverstripe, so why this very easy to fix bug is still here ?
I tried to go to the ticket but no way to load any ticket from the bug tracker since last saturday. (edit : ok manage to go to but no answers since 5 monthes...? )

How can we fix it ? where to provide the patch, how can we make this commited quickly ? Which is the process in silverstripe community ?



Community Member, 6 Posts

4 January 2011 at 2:04am

Edited: 04/01/2011 2:05am

forgot to say that RichMcNabb's patch solve the issue for me :-)


Community Member, 96 Posts

4 January 2011 at 7:52am

And also a happy new year to all! Had the same problem some time ago.
I solved it by installing the locales (dutch in my case) on my webserver.

apt-get install language-pack-nl-base

debian (lenny):
apt-get install debconf
dpkg-reconfigure locales

In Silverstripe i use the following for placing the datefields. Don't know how this is done in the blog module...

$date_field = new DateField('ArticleDate', 'Article date');
$date_field->setConfig('showcalendar', true);
$date_field->setConfig('showdropdown', true);
$date_field->setConfig('dateformat', 'dd-MM-YYYY');
$fields->addFieldToTab('Root.Content.Main', $date_field, 'Content');

And in _config.php

setlocale(LC_TIME, i18n::get_locale() . '.utf8');

hope this will help.