You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the PHP version of Mustache and have defined a helper to convert a date in yyyy-mm-dd format to mm/dd/yyyy format which looks like this:
`'_mdy' => function ($ymd) {
return date("m/d/Y", strtotime($ymd));
}`
I am using it in a template like this {{#concerts}} {{#_mdy}}{{ConcertStartDateTime}}{{/_mdy}} {{/concerts}}
All the dates from the concerts array are displayed as 12/31/1969 which I think is the value displayed when the date supplied to strtotime is not valid.
I added a line to the php script that assembles the data to execute the same command as in the helper ($concerts is the array supplied to the mustache renderer: echo date("m/d/Y", strtotime($concerts[0]['ConcertStartDateTime']))
and it displayed the correct date.
Other values from the concerts array are displayed correctly.
What am I doing wrong?
The text was updated successfully, but these errors were encountered:
I'm using the PHP version of Mustache and have defined a helper to convert a date in yyyy-mm-dd format to mm/dd/yyyy format which looks like this:
I am using it in a template like this
{{#concerts}} {{#_mdy}}{{ConcertStartDateTime}}{{/_mdy}} {{/concerts}}
All the dates from the concerts array are displayed as 12/31/1969 which I think is the value displayed when the date supplied to strtotime is not valid.
I added a line to the php script that assembles the data to execute the same command as in the helper ($concerts is the array supplied to the mustache renderer:
echo date("m/d/Y", strtotime($concerts[0]['ConcertStartDateTime']))
and it displayed the correct date.
Other values from the concerts array are displayed correctly.
What am I doing wrong?
The text was updated successfully, but these errors were encountered: