summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-12-03 15:51:06 -0500
committerJune McEnroe <june@causal.agency>2021-12-03 15:51:06 -0500
commita8ceef8126ddd507b8f5a6e3a20a542fa1244252 (patch)
treebfe6dd6dab56ae93aa079def34d599a292a758ac
parentAdd Six Months, Three Days, Five Others (diff)
downloadsrc-a8ceef8126ddd507b8f5a6e3a20a542fa1244252.tar.gz
src-a8ceef8126ddd507b8f5a6e3a20a542fa1244252.zip
Show weeks plus days
-rw-r--r--bin/when.y8
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/when.y b/bin/when.y
index 882fe60c..a9f6d1ed 100644
--- a/bin/when.y
+++ b/bin/when.y
@@ -139,8 +139,12 @@ static void printScalar(struct tm scalar) {
 		printf("%dw ", scalar.tm_mday / 7);
 	}
 	if (scalar.tm_yday && scalar.tm_mon) {
-		if (scalar.tm_yday % 7 == 0) {
-			printf("(%dw) ", scalar.tm_yday / 7);
+		if (scalar.tm_yday >= 7) {
+			printf("(%dw", scalar.tm_yday / 7);
+			if (scalar.tm_yday % 7) {
+				printf(" %dd", scalar.tm_yday % 7);
+			}
+			printf(") ");
 		}
 		printf("(%dd) ", scalar.tm_yday);
 	}