diff options
author | Louie S <louie@example.com> | 2023-07-04 17:59:48 -0700 |
---|---|---|
committer | Louie S <louie@example.com> | 2023-07-04 17:59:48 -0700 |
commit | 0bf5e72a2ee87af0e7ac3e2b769359084829a20f (patch) | |
tree | cc36f2451cf8fa8d27ffd680b8dbc6d08f39c1a7 /src/entry.c | |
parent | ed11c16d6687b0b51d41a598b93d7923331a3853 (diff) |
Fix date on entries
Diffstat (limited to 'src/entry.c')
-rw-r--r-- | src/entry.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/entry.c b/src/entry.c index c2958ed..253ef5e 100644 --- a/src/entry.c +++ b/src/entry.c @@ -11,8 +11,9 @@ int entry_get_group_id(Entry *e) { return e->group_id; } -struct tm entry_get_due_date(Entry *e) { - return e->due_date; +struct tm *entry_get_due_date(Entry *e) { + if(e->due_date_set) return &e->due_date; + return NULL; } char *entry_get_alt_due_date(Entry *e) { @@ -49,8 +50,15 @@ void entry_set_group_id(Entry *e, int id) { e->group_id = id; } -void entry_set_due_date(Entry *e, struct tm due_date) { - e->due_date = due_date; +void entry_set_due_date(Entry *e, struct tm *due_date) { + if(due_date != NULL) { + e->due_date = *due_date; + e->due_date_set = true; + } + else { + e->due_date = (struct tm){0}; + e->due_date_set = false; + } } void entry_set_alt_due_date(Entry *e, char *alt_due_date) { |