fix timezone bug

This commit is contained in:
beabigegg
2025-09-21 11:37:39 +08:00
parent a408ce402d
commit 2a0b29402f
22 changed files with 1050 additions and 519 deletions

View File

@@ -12,12 +12,18 @@
<div class="card-body">
<form method="post" enctype="multipart/form-data">
<p><strong>主題:</strong> {{ spec.title }}</p>
<p><strong>原結束日期:</strong> {{ spec.end_date.strftime('%Y-%m-%d') }}</p>
<p><strong>原結束日期:</strong> {{ spec.end_date|taiwan_date }}</p>
<p><strong>展延次數:</strong>
<span class="badge bg-info">{{ spec.extension_count }} / 2</span>
<small class="text-muted ms-2">
剩餘可展延次數: <strong>{{ 2 - spec.extension_count }}</strong>
</small>
</p>
<div class="mb-3">
<label for="new_end_date" class="form-label"><strong>新的結束日期</strong></label>
<input type="date" class="form-control" id="new_end_date" name="new_end_date"
value="{{ default_new_end_date.strftime('%Y-%m-%d') }}" required>
<input type="date" class="form-control" id="new_end_date" name="new_end_date"
value="{{ default_new_end_date|taiwan_date }}" required>
<div class="form-text">預設為原結束日期後一個月。</div>
</div>

View File

@@ -21,7 +21,7 @@
<span class="badge bg-primary rounded-pill me-2">{{ entry.action }}</span>
<strong>{{ entry.user.username if entry.user else '[已刪除的使用者]' }}</strong> 執行
</h5>
<small>{{ entry.timestamp.strftime('%Y-%m-%d %H:%M:%S') }}</small>
<small>{{ entry.timestamp|taiwan_time }}</small>
</div>
<p class="mb-1 mt-2">{{ entry.details }}</p>
</li>

View File

@@ -47,7 +47,7 @@
<th>建立日期</th>
<th>結束日期</th>
<th class="text-center">剩餘天數</th>
<th>狀態</th>
<th class="text-center">狀態</th>
<th class="text-center">操作</th>
</tr>
</thead>
@@ -57,8 +57,8 @@
<td>{{ spec.spec_code }}</td>
<td>{{ spec.title }}</td>
<td>{{ spec.applicant }}</td>
<td>{{ spec.created_at.strftime('%Y-%m-%d') }}</td>
<td>{{ spec.end_date.strftime('%Y-%m-%d') }}</td>
<td>{{ spec.created_at|taiwan_date }}</td>
<td>{{ spec.end_date|taiwan_date }}</td>
<td class="text-center">
{% if spec.status in ['active', 'expired'] %}
@@ -80,7 +80,7 @@
{% endif %}
</td>
<td>
<td class="text-center">
{% if spec.status == 'active' %}
<span class="badge fs-6 bg-success bg-opacity-75"><i class="bi bi-check-circle-fill me-1"></i>已生效</span>
{% elif spec.status == 'pending_approval' %}
@@ -90,6 +90,18 @@
{% else %}
<span class="badge fs-6 bg-secondary bg-opacity-75"><i class="bi bi-calendar-x-fill me-1"></i>已過期</span>
{% endif %}
{% if spec.extension_count > 0 %}
<br>
<div class="mt-1">
<span class="badge bg-light text-dark border">
<i class="bi bi-arrow-repeat me-1"></i>已展延 {{ spec.extension_count }} 次
</span>
{% if spec.extension_count >= 2 %}
<br><span class="badge bg-danger mt-1">達到上限</span>
{% endif %}
</div>
{% endif %}
</td>
<td class="text-center">
@@ -102,7 +114,11 @@
{% endif %}
{% if current_user.role in ['editor', 'admin'] and spec.status == 'active' %}
<a href="{{ url_for('temp_spec.extend_spec', spec_id=spec.id) }}" class="btn btn-sm btn-secondary" title="展延"><i class="bi bi-calendar-plus"></i></a>
{% if spec.extension_count < 2 %}
<a href="{{ url_for('temp_spec.extend_spec', spec_id=spec.id) }}" class="btn btn-sm btn-secondary" title="展延"><i class="bi bi-calendar-plus"></i></a>
{% else %}
<button class="btn btn-sm btn-secondary" disabled title="已達展延次數上限2次"><i class="bi bi-calendar-x"></i></button>
{% endif %}
<a href="{{ url_for('temp_spec.terminate_spec', spec_id=spec.id) }}" class="btn btn-sm btn-danger" title="終止"><i class="bi bi-x-circle"></i></a>
{% endif %}

View File

@@ -84,7 +84,7 @@
</td>
<td>
{% if user.last_login %}
{{ user.last_login.strftime('%Y-%m-%d %H:%M') }}
{{ user.last_login|taiwan_time('%Y-%m-%d %H:%M') }}
{% else %}
<span class="text-muted">從未登入</span>
{% endif %}