feat: Update date and time format handling

1. Changed the `DAYJS_ISO_DATE_FORMAT` constant to 'YYYY-MM-DD HH:mm'.

2. Updated the Gantt chart component's date-time parameters to `isoToKebabDatetime`.

3. Modified the date formatting in task data to `isoToKebabDatetime`.
This commit is contained in:
Wake Liu 2024-04-27 02:08:00 +08:00
parent d183fafa1e
commit 2833f97c16
1 changed files with 6 additions and 5 deletions

View File

@ -10,8 +10,8 @@
>
<GGanttChart
:date-format="DAYJS_ISO_DATE_FORMAT"
:chart-start="isoToKebabDate(filters.dateFrom)"
:chart-end="isoToKebabDate(filters.dateTo)"
:chart-start="isoToKebabDatetime(dateFromDate.toISOString())"
:chart-end="isoToKebabDatetime(dateToDate.toISOString())"
precision="day"
bar-start="startDate"
bar-end="endDate"
@ -50,6 +50,7 @@ import {getHexColor} from '@/models/task'
import {colorIsDark} from '@/helpers/color/colorIsDark'
import {isoToKebabDate} from '@/helpers/time/isoToKebabDate'
import {isoToKebabDatetime} from '@/helpers/time/isoToKebabDatetime'
import {parseKebabDate} from '@/helpers/time/parseKebabDate'
import type {ITask, ITaskPartialWithId} from '@/modelTypes/ITask'
@ -83,7 +84,7 @@ const emit = defineEmits<{
(e: 'update:task', task: ITaskPartialWithId): void
}>()
const DAYJS_ISO_DATE_FORMAT = 'YYYY-MM-DD'
const DAYJS_ISO_DATE_FORMAT = 'YYYY-MM-DD HH:mm'
const {tasks, filters} = toRefs(props)
@ -156,8 +157,8 @@ function transformTaskToGanttBar(t: ITask) {
}
return [{
startDate: isoToKebabDate(t.startDate ? t.startDate.toISOString() : props.defaultTaskStartDate),
endDate: isoToKebabDate(t.endDate ? t.endDate.toISOString() : props.defaultTaskEndDate),
startDate: isoToKebabDatetime(t.startDate ? t.startDate.toISOString() : props.defaultTaskStartDate),
endDate: isoToKebabDatetime(t.endDate ? t.endDate.toISOString() : props.defaultTaskEndDate),
ganttBarConfig: {
id: String(t.id),
label: t.title,