Jump to:

3373 Posts in 998 Topics by 712 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Who REALY used Expires.InPast?

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

Page: 1
Go to End
Author Topic: 834 Views
  • Jane Novice
    Avatar
    Community Member
    4 Posts

    Who REALY used Expires.InPast? Link to this post

    Who really ever used <% if Expires.InPast %> ... <% end_if %>?
    I'm struggling for over a year and it does not make any sense to me! See my post on 26 April 2009. (And I'm not the only one, that cannot figure it out.)

    I even bought the SilverStripe Book and on page 134 it says how it should work. but, please, wil anybody try it? Do not suppose that it will work, please try it! It does NOT work! The function outputs a 1 if the date is in the past, but it shows all the dates, regardless if it is in the past or not.

    Read this code below and the output, and read it carefully: 'Expiringdate has expired 24 days away.' is the output. Can you figure this out? Who will teach me how to use Expires.InPast or is it just FAKE?

    As you can tell, I'm desperate!

    Code:
    -------

    <% if Expires.InPast %>
    <h3>THE DATE HAS EXPIRED!</h3>
    <p><i>Today is $Now.</i></p>
    <p>Expiringdate is $Expires.</p>
    <p>Expiringdate has expired $Expires.Ago.</p>
    <% else %>
    <h3>Not yet Expired</h3>
    <p>Expiringdate will be $Expires.</p>
    <% end_if %>

    output:
    -------

    THE DATE HAS EXPIRED!

    Today is 2009-04-25.

    Expiringdate is 2009-05-20.

    Expiringdate has expired 24 days away.

    -------
    I'm using SilverStripe-v2.3.1.

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Who REALY used Expires.InPast? Link to this post

    2.3.1 is quite an old release. Have you tried a more recent update to check if your issue has been solved?

  • Jane Novice
    Avatar
    Community Member
    4 Posts

    Re: Who REALY used Expires.InPast? Link to this post

    I will make a new testsite with the latest version (2.4.1) and see what happens.
    But I doubt that this will solve the problem. I will post my findings.
    Thank you for your reply.

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