mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Improve date handling for task creation and retrieval
Update client-side and server-side logic to correctly process and store date values, ensuring compatibility with PostgreSQL timestamp types. This includes converting string dates to Date objects before insertion and ensuring string IDs are converted to numbers for API calls. Replit-Commit-Author: Agent Replit-Commit-Session-Id: f2b9c241-9fdd-4abd-9041-720afc8b27d6 Replit-Commit-Checkpoint-Type: full_checkpoint
This commit is contained in:
1 parent
3ec315ddd2
commit
9dc199d188
4 files changed
+221
-5
No files matched your search
+10
-3
@@ -1791,7 +1791,14 @@ export class DatabaseStorage implements IStorage {
|
||||
dueDateISO: taskData.dueDate instanceof Date ? taskData.dueDate.toISOString() : taskData.dueDate
|
||||
});
|
||||
|
||||
const [task] = await db.insert(tasks).values(taskData).returning();
|
||||
// Convert string dates to Date objects for Drizzle PostgreSQL
|
||||
const processedTaskData = {
|
||||
...taskData,
|
||||
startDate: taskData.startDate ? new Date(taskData.startDate) : null,
|
||||
dueDate: taskData.dueDate ? new Date(taskData.dueDate) : null,
|
||||
};
|
||||
|
||||
const [task] = await db.insert(tasks).values(processedTaskData).returning();
|
||||
|
||||
console.log('💾 DatabaseStorage.createTask - Result:', {
|
||||
taskId: task.id,
|
||||
@@ -1840,8 +1847,8 @@ export class DatabaseStorage implements IStorage {
|
||||
if (taskData.dueDate === '' || taskData.dueDate === null) {
|
||||
cleanData.dueDate = null;
|
||||
} else {
|
||||
// due_date est un date en PostgreSQL - on passe la chaîne directement
|
||||
cleanData.dueDate = taskData.dueDate;
|
||||
// due_date est un timestamp en PostgreSQL - convertir en Date object
|
||||
cleanData.dueDate = new Date(taskData.dueDate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user