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.

Archive /

Our old forums are still available as a read-only archive.

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

$Date.RangeString question


Go to End


1088 Views

Avatar
iadawn

Community Member, 13 Posts

10 September 2008 at 11:34am

Hi,

How is $Date.RangeString envisaged to work?

If I put:

$StartDate.RangeString( EndDate )

in a template. The error:

Fatal error: Call to a member function DayOfMonth() on a non-object .../sapphire/core/model/fieldtypes/Date.php on line 87

Occurs. This is because what is passed into RangeString is simply the string 'EndDate'. If I put:

$StartDate.RangeString( $EndDate )

in a template. The error:

Parse error: syntax error, unexpected T_STRING, expecting ')'

is raised from the cache. A quick look there shows:

$val .= $item->obj("StartDate")->XML_val("RangeString",array("
SSVIEWER;
$val .= $item->XML_val("EndDate",null,true) ;
$val .= <<<SSVIEWER
"),true) ;
$val .= <<<SSVIEWER

Which I am guessing is a bit of a wrong 'un. Is this an issue with the template parser?

Any thoughts would be appreciated.

Kevin