summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-06-05 12:20:13 -0400
committerJune McEnroe <june@causal.agency>2021-06-08 14:36:19 -0400
commitf93f10ed62ca8c7204955aa632993a1d9b0ecb89 (patch)
tree81eb8e5b99f00e789322d6eec6875a7c7b9a3f8d
parentMerge commit 'f46c4521d761a0b9909e17ef29065c0aa09c7ab7' (diff)
downloadsrc-f93f10ed62ca8c7204955aa632993a1d9b0ecb89.tar.gz
src-f93f10ed62ca8c7204955aa632993a1d9b0ecb89.zip
Show number of weeks for scalar if even
Diffstat (limited to '')
-rw-r--r--bin/when.y7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/when.y b/bin/when.y
index bba10c40..882fe60c 100644
--- a/bin/when.y
+++ b/bin/when.y
@@ -138,7 +138,12 @@ static void printScalar(struct tm scalar) {
 	} else if (scalar.tm_mday) {
 		printf("%dw ", scalar.tm_mday / 7);
 	}
-	if (scalar.tm_yday && scalar.tm_mon) printf("(%dd) ", scalar.tm_yday);
+	if (scalar.tm_yday && scalar.tm_mon) {
+		if (scalar.tm_yday % 7 == 0) {
+			printf("(%dw) ", scalar.tm_yday / 7);
+		}
+		printf("(%dd) ", scalar.tm_yday);
+	}
 	printf("\n");
 }