Time type query inconsistencies

I got two different queires:
const result = await database.query.employeesTable.findFirst({
where: eq(employeesTable.id, employeeId),
with: {
availabilities: true
}
});
const result = await database.query.employeesTable.findFirst({
where: eq(employeesTable.id, employeeId),
with: {
availabilities: true
}
});
const response = await database.query.eventTable.findFirst({
where: eq(eventTable.id, eventId),
with: {
tags: true,
allocations: {
with: {
employee: {
with: {
availabilities: {
where: and(
gte(availabilityTable.endTime, getOuterEventField(eventTable.endTime)),
lte(availabilityTable.startTime, getOuterEventField(eventTable.startTime)),
eq(availabilityTable.day, sql`WEEKDAY(${getOuterEventField(eventTable.date)})`)
)
}
}
}
}
}
}
}).execute()
const response = await database.query.eventTable.findFirst({
where: eq(eventTable.id, eventId),
with: {
tags: true,
allocations: {
with: {
employee: {
with: {
availabilities: {
where: and(
gte(availabilityTable.endTime, getOuterEventField(eventTable.endTime)),
lte(availabilityTable.startTime, getOuterEventField(eventTable.startTime)),
eq(availabilityTable.day, sql`WEEKDAY(${getOuterEventField(eventTable.date)})`)
)
}
}
}
}
}
}
}).execute()
The first outputs the Time field as:
availabilities: [
{
id: 2,
day: 0,
startTime: "22:02:00.000000",
endTime: "22:02:00.000000",
status: "UNCHANGED"
}
]
availabilities: [
{
id: 2,
day: 0,
startTime: "22:02:00.000000",
endTime: "22:02:00.000000",
status: "UNCHANGED"
}
]
The latter, outputs it as:
{
startTime: "22:29:00",
endTime: "23:31:00",
...
}
{
startTime: "22:29:00",
endTime: "23:31:00",
...
}
Is the nesting that causes the conversion? How could I have both returning in the hh/mm/ss format?
1 Reply
GT
GTOP2mo ago
^

Did you find this page helpful?