Use user's timezone for default entry date on log page
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
850f0fca8f
commit
68e66c5cd9
1 file changed
+7
-1
+7
-1
@@ -91,7 +91,13 @@
|
|||||||
<script src="/js/auth.js"></script>
|
<script src="/js/auth.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function today() {
|
function today() {
|
||||||
return new Date().toISOString().split('T')[0];
|
// en-CA formats as YYYY-MM-DD; use the user's saved timezone, falling back to the browser's
|
||||||
|
const tz = Auth.getUser()?.timezone;
|
||||||
|
try {
|
||||||
|
return new Intl.DateTimeFormat('en-CA', { timeZone: tz || undefined }).format(new Date());
|
||||||
|
} catch (_) {
|
||||||
|
return new Intl.DateTimeFormat('en-CA').format(new Date());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
|||||||
Reference in new issue
Block a user