Jump to:

1835 Posts in 1139 Topics by 554 members

Blog Module

SilverStripe Forums » Blog Module » Invalid Time Format

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 1825 Views
  • Shauna G
    Avatar
    Community Member
    52 Posts

    Invalid Time Format Link to this post

    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.

  • prawnstar
    Avatar
    Community Member
    116 Posts

    Re: Invalid Time Format Link to this post

    Bump.

    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?

    C.b

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

  • prawnstar
    Avatar
    Community Member
    116 Posts

    Re: Invalid Time Format Link to this post

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

    Chris.b

  • Shauna G
    Avatar
    Community Member
    52 Posts

    Re: Invalid Time Format Link to this post

    I've filed a bug report for it. It can be found here: http://open.silverstripe.org/ticket/5900

  • RichMcNabb
    Avatar
    Community Member
    34 Posts

    Re: Invalid Time Format Link to this post

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

  • pong
    Avatar
    Community Member
    6 Posts

    Re: Invalid Time Format Link to this post

    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 http://open.silverstripe.org/ticket/5900 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 ?

    Thanks

  • pong
    Avatar
    Community Member
    6 Posts

    Re: Invalid Time Format Link to this post

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

  • bartvanirsel
    Avatar
    Community Member
    88 Posts

    Re: Invalid Time Format Link to this post

    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.

    ubuntu:
    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.

    1825 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.