aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorEl-BG-1970 <elouan.gros.fr@gmail.com>2022-03-16 22:00:03 +0100
committerEl-BG-1970 <elouan.gros.fr@gmail.com>2022-03-16 22:00:03 +0100
commit2fd7e3647e70e6a925993c59d8c1751a904ae39a (patch)
tree9d3c469c08fe60139d4ad82d3762f690b43478ed /main.c
parenta37ece490f4cf269a58afdadf6e51f62d8529a41 (diff)
downloadorg-to-conky-2fd7e3647e70e6a925993c59d8c1751a904ae39a.tar.gz
added "THIS WEEK" directive
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/main.c b/main.c
index 73127d5..64ac9b2 100644
--- a/main.c
+++ b/main.c
@@ -78,20 +78,23 @@ int main(int argc, char **argv) {
// format nicely
char *e;
Date td = today();
- Date tm = tomorrow(td);
+ Date tm = tomorrow(td);
+ Date nm = nextmonday(td);
Date end = nextmonth(td);
- Date last_date = (struct Date){ -1, -1, -1 };
+ Date last_date = (struct Date){ -1, -1, -1, -1};
for (int i = 0; i < idx; i++) {
if (!eql(agenda[i].date, last_date)) {
last_date = agenda[i].date;
if (!zero(last_date)) {
- e = print_date_to_string(last_date);
+ e = short_date_to_string(last_date);
if (strictly_smaller(last_date, td))
printf("\n%s [OUTATIME]:\n", e);
else if (eql(last_date, td))
printf("\n%s [TODAY]:\n", e);
else if (eql(last_date, tm))
printf("\n%s [TOMORROW]:\n", e);
+ else if (strictly_smaller(last_date, nm))
+ printf("\n%s [THIS WEEK]:\n", e);
else if (smaller(last_date, end))
printf("\n%s:\n", e);
free(e);