Fix queue scheduled time displayed in wrong timezone

When editing a queue item, the scheduled time was being displayed in UTC
instead of the user's local timezone. This caused confusion where:
- User selects April 2, 2:00 PM local time
- After saving, it appears shifted by their timezone offset
- Month/day could appear swapped due to the timezone difference

The fix converts the UTC time from the server to local time when
populating the datetime-local input, using toDateTimeLocalValue()
instead of toISOString().slice(0, 16).

Closes #233
This commit is contained in:
maziggy
2026-02-04 07:35:55 +01:00
parent f96b27c5ee
commit b3c3ab0563
4 changed files with 73 additions and 68 deletions
+3
View File
@@ -15,6 +15,9 @@ All notable changes to Bambuddy will be documented in this file.
- Queue now shows "Paused" when the printer is paused instead of "Printing"
- Fetches real-time printer state for actively printing queue items
- Added translations for paused status in English, German, and Japanese
- **Queue Scheduled Time Displayed in Wrong Timezone** (Issue #233):
- Fixed scheduled time being displayed in UTC instead of local timezone when editing queue items
- The datetime picker now correctly shows and saves times in the user's local timezone
### Added
- **Windows Portable Launcher** (contributed by nmori):
+3 -1
View File
@@ -10,6 +10,7 @@ import { useToast } from '../../contexts/ToastContext';
import { useFilamentMapping } from '../../hooks/useFilamentMapping';
import { useMultiPrinterFilamentMapping, type PerPrinterConfig } from '../../hooks/useMultiPrinterFilamentMapping';
import { isPlaceholderDate } from '../../utils/amsHelpers';
import { toDateTimeLocalValue } from '../../utils/date';
import { PrinterSelector } from './PrinterSelector';
import { PlateSelector } from './PlateSelector';
import { FilamentMapping } from './FilamentMapping';
@@ -90,7 +91,8 @@ export function PrintModal({
let scheduledTime = '';
if (queueItem.scheduled_time && !isPlaceholderDate(queueItem.scheduled_time)) {
const date = new Date(queueItem.scheduled_time);
scheduledTime = date.toISOString().slice(0, 16);
// Use toDateTimeLocalValue to convert UTC to local time for datetime-local input
scheduledTime = toDateTimeLocalValue(date);
}
return {
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -23,7 +23,7 @@
<!-- Splash screens for iOS -->
<link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
<script type="module" crossorigin src="/assets/index-C32ywEzV.js"></script>
<script type="module" crossorigin src="/assets/index-C8HAsISy.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-fdAEMOwp.css">
</head>
<body>