Browse Source

NULL date and datetimes no longer render as current date/datetime in CRUD show templates

Brent Shaffer 13 years ago
parent
commit
a8f759da7d

+ 7 - 1
Resources/views/CRUD/show_date.html.twig

@@ -11,4 +11,10 @@ file that was distributed with this source code.
 
 {% extends 'SonataAdminBundle:CRUD:base_show_field.html.twig' %}
 
-{% block field %}{{ value|date('F j, Y') }}{% endblock %}
+{% block field%}
+    {%- if value is empty -%}
+         
+    {%- else -%}
+        {{ value|date('F j, Y') }}
+    {%- endif -%}
+{% endblock %}

+ 7 - 1
Resources/views/CRUD/show_datetime.html.twig

@@ -11,5 +11,11 @@ file that was distributed with this source code.
 
 {% extends 'SonataAdminBundle:CRUD:base_show_field.html.twig' %}
 
-{% block field %}{{ value|date }}{% endblock %}
+{% block field %}
+    {%- if value is empty -%}
+         
+    {%- else -%}
+        {{ value|date }}
+    {%- endif -%}
+{% endblock %}