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

Wrong Date Calculation with german dates?


Reply


2 Posts   993 Views

Avatar
lx

Community Member, 83 Posts

28 July 2010 at 6:04am

Hi,

i wanted the "last month's entries" on my BlogHolder.
Its a german Website so locale is "de_DE".

But the BlogHolder remained empty when i published some BlogEntries that are for example 5 days in the past.

I am not sure if its a Bug in BlogTree.php or if i am doing something wrong.

I guess the code in line 232

$d->sub($this->LandingPageFreshness);


is calculating wrong.
Instead of substituting 1 month, he substituted 1 day and added 1 hour.
see screenshot for debugmessages

When i change the line to:

$d->sub($this->LandingPageFreshness,null,'en_US');


its a little bit better, because he substitutes 1 month and 1 day

Anyone else with this problem?

Attached Files
Avatar
fool

Community Member, 4 Posts

17 January 2012 at 9:43am

Yes, I can confirm this behavior, choosing posts from the last 6 months just subtracted 6 days, locale being de_DE. With locale set to en_US like so (in blog/code/BlogTree.php):
$d->sub($this->LandingPageFreshness, null, 'en_US');
beams me 6 months and three days into the past. I guess it's a bug in ZF.

I went for the solution from this post:
http://www.silverstripe.org/blog-module-forum/show/17373#post310814
and it works...

Regards,

f.