I use swig in my nodejs project,when use date filter,I found this:
{{t.updateAt|date('Y-m-d H:i:s',-480)}}
NaN-NaN-NaN NaN:NaN:NaN
because sometimes t.updateAt is undefined, when this time I need date filter output ''.
so, How can I do?
{% if t.updateAt %}
{{t.updateAt|date('Y-m-d H:i:s',-480)}}
{% endif %}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.