Date Field - php allow dates eval

joomlamate

Member
I am trying to return certain dates on a date field plugin with the php allow dates function.
But it seems it doesn't work quite well for me.

This is the code I am trying out:

Code:
$begin = new DateTime();
$end = new DateTime('2017-04-10');

$interval = new DateInterval('P1D');
$daterange = new DatePeriod($begin, $interval ,$end);

$myAllowedDates = array();

foreach($daterange as $date){
    $thisDate = $date->format("Y-m-d");
    $myAllowedDates[] = $thisDate;
}
return $myAllowedDates;

Even from the moment I am writing this code in the textarea of the php allow dates function field, the editor reports me errors.
For example for line #1 the error is:
Undefined is not an object (evaluating 'e.value')

while in the foreach (line 9) it says:
Expected ')' and instead saw 'as'.
Missing semicolon.
Missing ";" before statement.
Expected an identifier and instead saw ')'.

D65EaAGkXi7acEaMi0OTzPH96N8XVSnIitNhXL3oL8M


In the front-end rendering the cal field when using the above php code, I am getting js errors

LpkKeupi6ORu2kZoBZR7pnZ_7NsuciMU2aoqGlrNw0A


I am not sure what I am doing wrong. Any ideas?
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top