Fix date in history for dev environment

This commit is contained in:
Gabriel Brown 2024-07-30 21:02:10 -05:00
parent d8b1aa242a
commit f3bb15aaeb

View File

@ -107,11 +107,17 @@ export const get_history = async (user_id: number, page: number, perPage: number
const totalCount = countrow[0]?.total_count ?? 0; const totalCount = countrow[0]?.total_count ?? 0;
const totalPages = Math.ceil(totalCount / perPage); const totalPages = Math.ceil(totalCount / perPage);
// Format and map results // Format and map results
const formattedResults: HistoryEntry[] = historyrows.map(row => ({ let formattedResults: HistoryEntry[] = historyrows.map(row => ({
name: row.name, name: row.name,
status: row.status, status: row.status,
updatedAt: new Date(row.updatedAt), updatedAt: new Date(row.updatedAt),
})); }));
if (process.env.NODE_ENV === 'development') {
formattedResults = formattedResults.map(entry => ({
...entry,
updatedAt: new Date(entry.updatedAt.setHours(entry.updatedAt.getUTCHours()+14)),
}));
}
return { return {
data: formattedResults, data: formattedResults,
meta: { meta: {