html - 将输入日期放入 thymeleaf 表中
问题描述
我想输入一个带有日期选择而不是这个的输入:
<td th:text="${#dates.format(client[3], 'dd-MM-yyyy HH:mm')}"></td>
并带有一个值 client[3]
客户 [3] 它的 -> 日期和时间
我希望日期可以更改。我需要做什么?
<table>
<tr>
<td>Name</td>
<td>Last Name</td>
<td>Email</td>
<td>End Date</td>
<th>Change datetime</th>
</tr>
<tr class="someclass" th:each="client : ${ClientsInSystem}">
<td th:text="${client[1]}"></td>
<td th:text="${client[2]}"></td>
<td th:text="${client[0]}"></td>
<td th:text="${#dates.format(client[3], 'dd-MM-yyyy HH:mm')}"></td>
<!-- <input type="date" id="start" th:value="${#dates.format(client[3], 'dd-MM-yyyy HH:mm')}">-->
<td>
<button th:href="${'bla'}">Extend trial</button>
</td>
</tr>
</table>
解决方案
我找到了我需要的东西:)
<tr class="someClass" th:each="client : ${ClientsInSystem}">
<td th:text="${client[1]}"></td>
<td th:text="${client[2]}"></td>
<td th:text="${client[0]}"></td>
<td> <input type="date" id="dateForUpdate" th:value="${#dates.format(client[3], 'yyyy-MM-dd')}"> </td>
<td> <button class="btn" th:onclick="updateDateForTrialUser()">Extend trial</button> </td>
</td>
</tr>