Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

created_on, edited_on fields can't displayed in twig template #15

Open
Sellato opened this issue Dec 5, 2019 · 9 comments
Open

created_on, edited_on fields can't displayed in twig template #15

Sellato opened this issue Dec 5, 2019 · 9 comments

Comments

@Sellato
Copy link
Contributor

Sellato commented Dec 5, 2019

I can't display fields created_on and edited_on in twig template.
Using this construction {{ quote.quote }} I can display ALL fields except created_on and edited_on fields. {{ quote.created_on }} display CURRENT day/time not a data created_on from database :(

Can somebody help me to fix this problem?
Thanks.

@jonasdekeukelaere
Copy link
Member

It might be {{ quote.createdOn }} (without the camelcase)

@Sellato
Copy link
Contributor Author

Sellato commented Dec 5, 2019

sorry, not working :(
what I use:
<time>{{ feedback.createdOn|spoondate() }}</time> result - 2019-12-05 14:45:34
<time>{{ feedback.createdon|spoondate() }}</time> result - 2019-12-05 14:45:50
<time>{{ feedback.created_on|spoondate() }}</time> result - 2019-12-05 14:46:01

I try a wrong field created
<time>{{ feedback.created|spoondate() }}</time> result - 2019-12-05 14:46:20

result the same, current date/time.

debug mode is disabled, cache is cleaned, cookies removed.

@jonasdekeukelaere
Copy link
Member

I think {{ feedback.createdOn }} is a DateTime field, so you can use {{ feedback.createdOn|date('d-m-Y') }}, if you really want to use spoondate, I think it's something like {{ feedback.createdOn.timstamp|spoondate }}

@Sellato
Copy link
Contributor Author

Sellato commented Dec 5, 2019

still current date :(

{{ feedback.createdOn|date('d-m-Y') }} result 05-12-2019
{{ feedback.createdOn.timstamp|spoondate }} result 2019-12-05 16:14:35

@jonasdekeukelaere
Copy link
Member

No idea without doing some testing then, sorry

@Sellato
Copy link
Contributor Author

Sellato commented Dec 5, 2019

ok, be waiting

@jonasdekeukelaere
Copy link
Member

Apparently there is no getter for createdOn, but there is a toArray method you can use if you can't PR the getters:
{{ quote.toArray()['created_on']|date('d-m-Y H:i:s') }} or {{ quote.toArray()['created_on'].timestamp|spoondate }}

@Sellato
Copy link
Contributor Author

Sellato commented Dec 5, 2019

great!!!! thank you :) works fine.
date published neattmaster on Apr 14, 2015 result 2015-04-14 17:45:14

@jonasdekeukelaere
Copy link
Member

I'll leave the issue open, so the getters can be added by someone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants