Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Major BUG in blog module???

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 2392 Views
  • dio5
    Avatar
    Community Member
    501 Posts

    Major BUG in blog module??? Link to this post

    I was checking the blog module and basing part of what I'm building on the code of it, while I discovered this pretty nasty bug:

    In the backend cms, the calendardatefield switches day and month, and so the calendar popup also gives the wrong date: today would be 12 februari instead of 2 december.

    I can't imagine nobody has seen this yet? It might be possible it only does this in the last month?

    I'll open a ticket for this....

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: Major BUG in blog module??? Link to this post

    Ok what I've found was mostly interesting:

    This in the populateDefaults() method on blogentry

    $this->Date = date("d/m/Y H:i:s",time());

    makes the date switched. (even though it is in d/m/Y here?! )

    Leaving it out, just gives a blank field in the cms.

    But putting this in the populateDefaults thing

    $this->Date = date("H:i:s",time());

    (so without the d/m/Y) gives the correct date....

    How?!

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: Major BUG in blog module??? Link to this post

    Putting this:

    $this->Date = date("Y-m-d H:i:s",time());

    in the populateDefaults method

    also gives the correct date...

    I'm wondering what's going on, maybe the javascript is expecting something and messes it up... weird.

  • Tim
    Avatar
    Core Development Team
    201 Posts

    Re: Major BUG in blog module??? Link to this post

    Hi Dieter - it would be great if your able to submit a patch for this

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: Major BUG in blog module??? Link to this post

    Well, I guess the patch would just be by replacing the / with - in the populateDefaults method in blogentry.php.

    Like in $this->Date = date("Y-m-d H:i:s",time());

    But maybe the one who made the blogmodule can provide more insight to why / was used and why with - it still displays as /

    I'm not to keen on submitting a patch without actually being sure I tackled the real cause of it. , I'm not a professional programmer you know

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Major BUG in blog module??? Link to this post

    Andy and Jeremy were the ones who originally made the blog module. Perhaps they can provide some insight.

    Cheers,
    Sean

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts

    Re: Major BUG in blog module??? Link to this post

    Thanks for finding this dio5!

    I assume this bug is produced when you create a new blogentry page from the CMS...correct?
    Doing this didn't give me a switched date, but definitely showed the wrong date.

    If that wasn't the way you produced the bug, let us know. For the mean time I've made the date-format change to "Y-m-d H:i:s".

    http://open.silverstripe.com/ticket/1941

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: Major BUG in blog module??? Link to this post

    Yep, it was from in the cms. I tried this on the demosite too, and it had the same 'switched' result.

    Now I just tried it again on the demo-site, and it set the date to 01/01/1970, so something has changed, but it still does weird.

    2392 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.