소스 검색

custom date and datetime formats in show

Tiago Garcia 12 년 전
부모
커밋
0a584b54a0
2개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      Resources/views/CRUD/show_date.html.twig
  2. 2 0
      Resources/views/CRUD/show_datetime.html.twig

+ 2 - 0
Resources/views/CRUD/show_date.html.twig

@@ -14,6 +14,8 @@ file that was distributed with this source code.
 {% block field%}
     {%- if value is empty -%}
          
+    {%- elseif field_description.options.format is defined -%}
+        {{ value|date(field_description.options.format) }}
     {%- else -%}
         {{ value|date('F j, Y') }}
     {%- endif -%}

+ 2 - 0
Resources/views/CRUD/show_datetime.html.twig

@@ -14,6 +14,8 @@ file that was distributed with this source code.
 {% block field %}
     {%- if value is empty -%}
          
+    {%- elseif field_description.options.format is defined -%}
+        {{ value|date(field_description.options.format) }}
     {%- else -%}
         {{ value|date }}
     {%- endif -%}