GPT : Timezone and reporting improvements

Add timezone-aware timestamp support and reporting improvements
Store timestamps in ISO-8601 format with timezone offsets
Accept client-local timestamps from browser and API
Normalize legacy naive timestamps during parsing
Add migration script for converting old SQLite timestamps
Fix mixed naive/aware datetime comparison errors
Render timestamps in browser-local timezone
Auto-generate default 7-day reports on page load
Expand default dashboard report to include all users
Preserve manual single-user report generation
Add curl-based validation/test script for API and report flows
This commit is contained in:
2026-05-29 10:55:56 -04:00
parent f175321283
commit 4ee4ced6eb
4 changed files with 473 additions and 84 deletions

77
test.sh Normal file
View File

@@ -0,0 +1,77 @@
#!/usr/bin/env bash
set -e
BASE_URL="http://127.0.0.1:5000"
echo "======================================="
echo "Fetching users"
echo "======================================="
curl -s \
"${BASE_URL}/api/users" \
| jq .
echo
echo "======================================="
echo "Clocking IN user 1"
echo "======================================="
curl -s \
-X POST \
-H "Content-Type: application/json" \
-d '{
"user_id": 1,
"entrytype": "in",
"timestamp": "2026-05-29T08:00:00-04:00"
}' \
"${BASE_URL}/api/entries" \
| jq .
sleep 1
echo
echo "======================================="
echo "Clocking OUT user 1"
echo "======================================="
curl -s \
-X POST \
-H "Content-Type: application/json" \
-d '{
"user_id": 1,
"entrytype": "out",
"timestamp": "2026-05-29T17:00:00-04:00"
}' \
"${BASE_URL}/api/entries" \
| jq .
echo
echo "======================================="
echo "Fetching entries"
echo "======================================="
curl -s \
"${BASE_URL}/api/entries" \
| jq .
echo
echo "======================================="
echo "Generating report through web form"
echo "======================================="
curl -s \
-X POST \
-d "user_id=1" \
-d "action=report" \
-d "begin_date=2026-05-22T00:00:00-04:00" \
-d "end_date=2026-05-29T23:59:59-04:00" \
"${BASE_URL}/" \
> report.html
echo "Report saved to report.html"
echo
echo "======================================="
echo "Done"
echo "======================================="