Jump to:

1835 Posts in 1139 Topics by 554 members

Blog Module

SilverStripe Forums » Blog Module » Wrong Date Calculation with german dates?

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 927 Views
  • lx
    Avatar
    Community Member
    81 Posts

    Wrong Date Calculation with german dates? Link to this post

    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
  • fool
    Avatar
    Community Member
    4 Posts

    Re: Wrong Date Calculation with german dates? Link to this post

    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.

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