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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

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

Who REALY used Expires.InPast?


Go to End


3 Posts   1553 Views

Avatar
Jane Novice

Community Member, 4 Posts

31 July 2010 at 9:59am

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.

Avatar
Willr

Forum Moderator, 5523 Posts

31 July 2010 at 6:15pm

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

Avatar
Jane Novice

Community Member, 4 Posts

31 July 2010 at 9:05pm

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.