diff --git a/src/dodo.c b/src/dodo.c index e3a7899..d6a0322 100644 --- a/src/dodo.c +++ b/src/dodo.c @@ -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); diff --git a/src/dodo.schema b/src/dodo.schema index 28e16f9..5ccebc8 100644 --- a/src/dodo.schema +++ b/src/dodo.schema @@ -7,7 +7,7 @@ CREATE TABLE tasks( due_date TEXT, CHECK ( due_date IS NULL OR - due_date GLOB '????-??-??' + due_date GLOB '??-??-????' ) );