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.

Data Model Questions

Who REALY used Expires.InPast?


3 Posts   900 Views

Jane Novice

31 July 2010 at 9:59am Community Member, 4 Posts

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!


<% if Expires.InPast %>
<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 %>



Today is 2009-04-25.

Expiringdate is 2009-05-20.

Expiringdate has expired 24 days away.

I'm using SilverStripe-v2.3.1.


31 July 2010 at 6:15pm Forum Moderator, 5511 Posts

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

31 July 2010 at 9:05pm Community Member, 4 Posts

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.