X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fcalendar_view.c;h=191ea78d19b505f9c7053aee3c459b2531a46f48;hb=f0ad29eb6d52c35117854c3fe9e7941a97282de5;hp=2de090f331471e8549f7e2eb65424a69e79e8c03;hpb=6407b2dc6f0751fc6da23046994af878045a2a35;p=citadel.git diff --git a/webcit/calendar_view.c b/webcit/calendar_view.c index 2de090f33..191ea78d1 100644 --- a/webcit/calendar_view.c +++ b/webcit/calendar_view.c @@ -501,15 +501,23 @@ void calendar_month_view_brief_events(time_t thetime, const char *daycolor) { void calendar_month_view(int year, int month, int day) { struct tm starting_tm; struct tm tm; + struct tm today_tm; time_t thetime; int i; time_t previous_month; time_t next_month; time_t colheader_time; + time_t today_timet; struct tm colheader_tm; char colheader_label[32]; long weekstart = 0; + /* + * Make sure we know which day is today. + */ + today_timet = time(NULL); + localtime_r(&today_timet, &today_tm); + /* * Determine what day to start. If an impossible value is found, start on Sunday. */ @@ -599,7 +607,7 @@ void calendar_month_view(int year, int month, int day) { wc_printf("
", ((tm.tm_mon != month-1) ? "out" : - ((tm.tm_mday == day) ? "today" : + (((tm.tm_year == today_tm.tm_year) && (tm.tm_mon == today_tm.tm_mon) && (tm.tm_mday == today_tm.tm_mday)) ? "today" : ((tm.tm_wday==0 || tm.tm_wday==6) ? "weekend" : "day"))) );