Qwen broke several things with the last features. Fix those. Handle user timezones properly. Use a textarea for the comments instead of a text input.

This commit is contained in:
2026-06-16 12:16:41 -04:00
parent 1a85ca6830
commit dbd8b6e6ac
2 changed files with 163 additions and 128 deletions

View File

@@ -68,6 +68,12 @@
<form method="POST" id="timeclock-form">
<input
type="hidden"
id="client_timezone"
name="client_timezone"
value=""/>
<input
type="hidden"
name="client_timestamp"
@@ -139,8 +145,7 @@
type="datetime-local"
name="begin_date"
id="begin_date"
value=""
>
value="">
</td>
</tr>
@@ -161,12 +166,11 @@
<td>Comments</td>
<td>
<input
type="textarea"
name="comments"
<textarea
name="comments"
id="comments"
value=""
>
rows="5" cols="72"
></textarea>
</td>
</tr>
@@ -190,7 +194,7 @@
<br>
{% if report_hours is not none %}
{% if user_report is not none %}
<h2>Custom Report</h2>
@@ -199,11 +203,19 @@
<tr>
<th>Total Hours Worked</th>
<th>Paid Hours</th>
<th>Actions</th>
</tr>
<tr>
<td>{{ report_hours.total_hours }}</td>
<td>{{ report_hours.paid_hours }}</td>
<td>{{ user_report.total_hours }}</td>
<td>{{ user_report.paid_hours }}</td>
<td>
<ul>
{% for action in user_report.actions %}
<li>{{ action }}</li>
{% endfor %}
</ul>
</td>
</tr>
</table>
@@ -212,6 +224,19 @@
<script>
function getFormattedOffset() {
const offset = new Date().getTimezoneOffset();
const absMinutes = Math.abs(offset);
// Invert the sign to match standard UTC notation
const sign = offset <= 0 ? "+" : "-";
const hours = String(Math.floor(absMinutes / 60)).padStart(2, "0");
const minutes = String(absMinutes % 60).padStart(2, "0");
return `${sign}${hours}:${minutes}`;
}
function localDatetimeValue(date) {
const pad = (v) => String(v).padStart(2, "0");
return (
@@ -231,6 +256,7 @@ window.addEventListener("load", () => {
const now = new Date();
const weekAgo = new Date();
weekAgo.setDate(now.getDate() - 7);
document.getElementById("client_timezone").value = getFormattedOffset();
document.getElementById("begin_date").value = localDatetimeValue(weekAgo);
document.getElementById("end_date").value = localDatetimeValue(now);
document.querySelectorAll(".tztime").forEach((el) => {