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.

Archive

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

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

Major BUG in blog module???


Reply

8 Posts   2402 Views

Avatar
dio5

2 December 2007 at 1:55am (Last edited: 2 December 2007 2:23am), Community Member, 501 Posts

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

Avatar
dio5

2 December 2007 at 2:09am Community Member, 501 Posts

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?!

Avatar
dio5

2 December 2007 at 2:13am Community Member, 501 Posts

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.

Avatar
Tim

2 December 2007 at 10:09am Core Development Team, 201 Posts

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

Avatar
dio5

2 December 2007 at 10:14am (Last edited: 2 December 2007 10:16am), Community Member, 501 Posts

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 :-)

Avatar
Sean

2 December 2007 at 11:11am Forum Moderator, 921 Posts

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

Cheers,
Sean

Avatar
Jedateach

14 January 2008 at 3:17pm (Last edited: 14 January 2008 3:23pm), Forum Moderator, 227 Posts

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

Avatar
dio5

14 January 2008 at 10:05pm (Last edited: 15 January 2008 6:20am), Community Member, 501 Posts

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