summary refs log tree commit diff
path: root/bin
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
commit4627543c2f5387f0178b6766cf9c856e2352cc73 (patch)
tree4f9422307ec9d3230e96428a03896991e534eb54 /bin
parentMerge commit '5213546273ee798369ff594ad60077f1bef4655e' (diff)
downloadsrc-4627543c2f5387f0178b6766cf9c856e2352cc73.tar.gz
src-4627543c2f5387f0178b6766cf9c856e2352cc73.zip
Show number of weeks for scalar if even
Diffstat (limited to 'bin')
-rw-r--r--bin/when.y7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/when.y b/bin/when.y
index 5367b3b3..d647d193 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");
 }