Skip to content

Commit 44293ec

Browse files
authored
Bugfix: date was incorrectly sorted
1 parent 0768ff7 commit 44293ec

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

templates/modules/my-car/components/table.html.twig

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,28 @@
3838
{% endif %}
3939

4040
<tr class="trash-parent car-single-data editable-parent save-parent " data-type="MyCar">
41+
4142
{% for column in column_names %}
42-
<td class="{{ column }} {{ hideIdColumn(column) }}" style="{{ date_color_style}}{{ common_style }}">
43-
{% if attribute(car_data,column).timestamp is defined %}
44-
{{ attribute(car_data,column)|date('d-m-Y') }}
45-
{% else %}
43+
44+
{% if column == 'date' %}
45+
46+
{% set timestamp = date( car_data.date | date('m/d/yyyy') ).timestamp %}
47+
48+
<td class="{{ column }} {{ hideIdColumn(column) }}"
49+
style="{{ date_color_style}}{{ common_style }}"
50+
data-order="{{ timestamp }}"
51+
>
52+
{{ car_data.date}}
53+
</td>
54+
55+
{% else %}
56+
57+
<td class="{{ column }} {{ hideIdColumn(column) }}" style="{{ date_color_style}}{{ common_style }}">
4658
{{ attribute(car_data,column) }}
47-
{% endif %}
48-
</td>
59+
</td>
60+
61+
{% endif %}
62+
4963
{% endfor %}
5064

5165
<td class="parent-td">

0 commit comments

Comments
 (0)