fix: 一个月内时间显示xx天前,其余显示日期 #78
This commit is contained in:
parent
9f1b681913
commit
8b493c0f9b
|
@ -57,11 +57,26 @@
|
||||||
</span>
|
</span>
|
||||||
</th:block>
|
</th:block>
|
||||||
<!-- 创建时间 -->
|
<!-- 创建时间 -->
|
||||||
<span class="post-meta-date">
|
<span class="post-meta-date" th:with="days=${(new java.util.Date().getTime()-post.spec.publishTime.toEpochMilli())/86400000}">
|
||||||
<i class="far fa-calendar-alt"></i>
|
<i class="far fa-calendar-alt"></i>
|
||||||
<span class="article-meta-label">创建</span>
|
<span class="article-meta-label">创建</span>
|
||||||
<time style="display: inline;" th:text="${#dates.format(post.spec.publishTime,'yyyy-MM-dd')}"
|
<time style="display: inline;"
|
||||||
th:title="${#dates.format(post.spec.publishTime,'yyyy-MM-dd')}">
|
th:if="${days > 30}"
|
||||||
|
th:text="${#dates.format(post.spec.publishTime,'yyyy-MM-dd')}"
|
||||||
|
th:datetime="${post.spec.publishTime}"
|
||||||
|
th:title="${#dates.format(post.spec.publishTime,'yyyy-MM-dd')}+创建">
|
||||||
|
</time>
|
||||||
|
<time style="display: inline;"
|
||||||
|
th:if="${days <= 30 && days > 0}"
|
||||||
|
th:text="${days}+天前"
|
||||||
|
th:datetime="${post.spec.publishTime}"
|
||||||
|
th:title="${#dates.format(post.spec.publishTime,'yyyy-MM-dd')}+创建">
|
||||||
|
</time>
|
||||||
|
<time style="display: inline;"
|
||||||
|
th:if="${days == 0}"
|
||||||
|
th:text="最近"
|
||||||
|
th:datetime="${post.spec.publishTime}"
|
||||||
|
th:title="${#dates.format(post.spec.publishTime,'yyyy-MM-dd')}+创建">
|
||||||
</time>
|
</time>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue