fix: normalize span annotation timestamps to Unix epoch seconds in all API responses
This commit is contained in:
parent
900443d078
commit
c404e79678
2 changed files with 22 additions and 3 deletions
|
|
@ -42,7 +42,13 @@ export async function PATCH(
|
|||
.where(eq(spanAnnotations.id, parseInt(id)))
|
||||
.returning();
|
||||
|
||||
return NextResponse.json(result[0]);
|
||||
const s = result[0];
|
||||
return NextResponse.json({
|
||||
...s,
|
||||
start_time: s.start_time instanceof Date ? Math.floor(s.start_time.getTime() / 1000) : s.start_time,
|
||||
end_time: s.end_time instanceof Date ? Math.floor(s.end_time.getTime() / 1000) : s.end_time,
|
||||
created_at: s.created_at instanceof Date ? Math.floor(s.created_at.getTime() / 1000) : s.created_at,
|
||||
});
|
||||
} catch (error: any) {
|
||||
console.error('Error updating span annotation:', error);
|
||||
return NextResponse.json(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue