am-impact / amforms

Forms plugin for Craft
Other
121 stars 21 forks source link

Get the latest Submission Date #157

Open kaspar-allenbach opened 7 years ago

kaspar-allenbach commented 7 years ago

Not sure if this is a plugin issue:

I want to get all the submissions like this:

{% set latestSubmission = craft.amForms.submissions(
    { formHandle: 'reservation', order: 'dateCreated desc' }).datum('>= '~now).dateCreated().first()
%}

{{ latestSubmission }}

this outputs:

Do., 07 Sep. 2017 10:32:05

Now when I want to formate date for example let's say:

{{ latestSubmission | date('m.d.Y') }}

There is a error:

DateTime::__construct(): Failed to parse time string (Do., 07 Sep. 2017 10:32:05) at position 0 (D): The timezone could not be found in the database

It seems as if the outputed time string is no longer valid when applying the date filter. Could it be that am forms saves the timestamp in the wrong format in the db?