Jump to:

1851 Posts in 1606 Topics by 561 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: 978 Views
  • lx
    Community Member
    82 Posts

    Wrong Date Calculation with german dates? Link to this post


    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


    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:


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

    Anyone else with this problem?

    Attached Files
  • fool
    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:
    and it works...



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.