Modified date format to dd-mm-yyyy

This commit is contained in:
xavi 2024-10-05 22:33:08 -07:00
parent f9b704e423
commit 077c9d2828
2 changed files with 4 additions and 2 deletions

View File

@ -119,7 +119,7 @@ int get_due_date(filtered_tasks *task, char* passed_date){
}
task->due_date = malloc(ARG_MAX * sizeof(char));
snprintf(task->due_date, ARG_MAX, "%04d-%02d-%02d", d->year, d->month, d->day);
snprintf(task->due_date, ARG_MAX, "%02d-%02d-%04d", d->day, d->month, d->year);
return 0;
}
@ -343,6 +343,8 @@ int bind_sql_insert_stmt(filtered_tasks* task, sqlite3_stmt* out_stmt){
return -1;
}
// TODO: I think instead of string we should make it a date and then make a string here
if ( task->due_date ){
param_pos = 2;
rc = sqlite3_bind_text(out_stmt, param_pos, task->due_date, -1, SQLITE_STATIC);

View File

@ -7,7 +7,7 @@ CREATE TABLE tasks(
due_date TEXT,
CHECK (
due_date IS NULL OR
due_date GLOB '????-??-??'
due_date GLOB '??-??-????'
)
);