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, biapar, Willr, Ingo, swaiba, simon_w

Invalid Time Format


8 Posts   1955 Views

Shauna G

8 July 2010 at 1:58pm Community Member, 52 Posts

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.


16 July 2010 at 8:00am (Last edited: 16 July 2010 8:02am), Community Member, 116 Posts


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?


29 July 2010 at 9:15am Community Member, 116 Posts

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


Shauna G

3 August 2010 at 6:20am Community Member, 52 Posts

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


24 November 2010 at 10:01am Community Member, 34 Posts

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');


4 January 2011 at 1:47am (Last edited: 4 January 2011 1:55am), Community Member, 6 Posts

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 ?



4 January 2011 at 2:04am (Last edited: 4 January 2011 2:05am), Community Member, 6 Posts

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


4 January 2011 at 7:52am Community Member, 94 Posts

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.