diff --git a/src/App.vue b/src/App.vue index b80ad57..e0da75e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -156,6 +156,25 @@ const logicalMinutesToTime = (min: number) => { return `${String(h).padStart(2, '0')}:${String(m).padStart(2, '0')}`; }; +const logicalMinutesFromTime = (timeStr: string) => { + const [h, m] = timeStr.split(":").map(Number); + let total = h * 60 + m; + // If hour < 3, it belongs to the "late night" part of our logical day (03:00 to 03:00) + if (h < 3) total += 1440; + return total - TIME_OFFSET_MINUTES; +}; + +// Computed properties for time inputs in the modal +const startTimeInput = computed({ + get: () => logicalMinutesToTime(editingEvent.value.start_minute), + set: (val) => { editingEvent.value.start_minute = logicalMinutesFromTime(val); } +}); + +const endTimeInput = computed({ + get: () => logicalMinutesToTime(editingEvent.value.end_minute), + set: (val) => { editingEvent.value.end_minute = logicalMinutesFromTime(val); } +}); + const updatePreview = async (img: TimelineItem | null) => { if (!img || (selectedImage.value?.path === img.path && previewSrc.value)) return; selectedImage.value = img; @@ -319,8 +338,14 @@ const resetTagForm = () => { newTagName.value = ""; newTagParent.value = null; n

{{ editingEvent.id ? '编辑事件' : '新增记录' }}

-
{{ logicalMinutesToTime(editingEvent.start_minute) }}
-
{{ logicalMinutesToTime(editingEvent.end_minute) }}
+
+ + +
+
+ + +