Improve flight view appearance

This commit is contained in:
april
2024-01-04 16:55:12 -06:00
parent 887f83119f
commit 04813bfd76
4 changed files with 322 additions and 25 deletions

View File

@@ -14,11 +14,6 @@ type FlightBaseSchema = {
tach_start: number | null;
tach_end: number | null;
time_start: number | null;
time_off: number | null;
time_down: number | null;
time_stop: number | null;
time_total: number;
time_pic: number;
time_sic: number;
@@ -52,16 +47,31 @@ type FlightBaseSchema = {
type FlightFormSchema = FlightBaseSchema & {
date: dayjs.Dayjs;
time_start: number | null;
time_off: number | null;
time_down: number | null;
time_stop: number | null;
};
type FlightCreateSchema = FlightBaseSchema & {
date: string;
time_start: dayjs.Dayjs;
time_off: dayjs.Dayjs;
time_down: dayjs.Dayjs;
time_stop: dayjs.Dayjs;
};
type FlightDisplaySchema = FlightBaseSchema & {
id: string;
user: string;
date: dayjs.Dayjs;
time_start: number | null;
time_off: number | null;
time_down: number | null;
time_stop: number | null;
};
type FlightConciseSchema = {
@@ -86,6 +96,22 @@ const flightCreateHelper = (values: FlightFormSchema): FlightCreateSchema => {
hobbs_end: Number(values.hobbs_end),
tach_start: Number(values.tach_start),
tach_end: Number(values.tach_end),
time_start: values.date
.utc()
.hour(values.time_start ?? 0 / 100)
.minute(values.time_start ?? 0 % 100),
time_off: values.date
.utc()
.hour(values.time_off ?? 0 / 100)
.minute(values.time_off ?? 0 % 100),
time_down: values.date
.utc()
.hour(values.time_down ?? 0 / 100)
.minute(values.time_down ?? 0 % 100),
time_stop: values.date
.utc()
.hour(values.time_stop ?? 0 / 100)
.minute(values.time_stop ?? 0 % 100),
};
};