diff --git a/src/dodo.c b/src/dodo.c index c50322e..fa6c4de 100644 --- a/src/dodo.c +++ b/src/dodo.c @@ -38,13 +38,22 @@ int init_date(date *d){ struct tm *local = localtime(&rawtime); d->year = local->tm_year + 1900; - d->month = local->tm_mon; - d->year = local->tm_mday; + d->month = local->tm_mon + 1; + d->day = local->tm_mday; return 0; } +int get_due_date(filtered_tasks *task, char* due_date){ + date *d = malloc(sizeof(date)); + + init_date(d); + + printf("%d-%d-%d\n", d->month, d->day, d->year); + +} + void init_filtered_tasks(filtered_tasks* task){ task->selected_columns = NULL; task->title = NULL; @@ -391,6 +400,7 @@ int parse_args(int argc, char** argv, filtered_tasks* task){ if ( argc > 3 ){ if ( x_strcmp(argv[1], "update") ){ + get_due_date(task, argv[3]); task->due_date = argv[3]; return 0; } @@ -400,6 +410,7 @@ int parse_args(int argc, char** argv, filtered_tasks* task){ } if ( argc > 4 ){ + get_due_date(task, argv[4]); task->due_date = argv[4]; } diff --git a/src/dodo.h b/src/dodo.h index 0e53d4a..6722a02 100644 --- a/src/dodo.h +++ b/src/dodo.h @@ -41,6 +41,10 @@ int view_all(sqlite3 *db); // filtered_tasks constructor void init_filtered_tasks(filtered_tasks* task); +// Due Date stuff +int init_date(date* date); +int get_due_date(filtered_tasks *task, char* due_date); + // sql generators TODO: might be able to boil this down to 1 func int prepare_sql_update_stmt(sqlite3 *db, sqlite3_stmt** out_stmt, filtered_tasks* task); int prepare_sql_delete_stmt(sqlite3 *db, sqlite3_stmt** out_stmt, filtered_tasks* task);