else
month->weeks[i] = SPACE;
weeklines--;
- if (52 < weeknum && i == 0)
+ if (i == 0 && (52 < weeknum || (month->year == 1753 && 51 < weeknum)))
weeknum = week_number(month->days[DAYS_IN_WEEK * (i + 1)], 1, month->year, ctl);
else if (52 < weeknum)
weeknum = week_number(31, 12, month->year, ctl);
--- /dev/null
+
+Monday-based 1753 week numbers
+ December 1752 January 1753 February 1753
+ Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
+47 1 2 3 1 1 2 3 4 5 6 7 5 1 2 3 4
+48 4 5 6 7 8 9 10 2 8 9 10 11 12 13 14 6 5 6 7 8 9 10 11
+49 11 12 13 14 15 16 17 3 15 16 17 18 19 20 21 7 12 13 14 15 16 17 18
+50 18 19 20 21 22 23 24 4 22 23 24 25 26 27 28 8 19 20 21 22 23 24 25
+51 25 26 27 28 29 30 31 5 29 30 31 9 26 27 28
+
+Sunday-based 1753 week numbers
+ December 1752 January 1753 February 1753
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+46 1 2 51 1 2 3 4 5 6 4 1 2 3
+47 3 4 5 6 7 8 9 1 7 8 9 10 11 12 13 5 4 5 6 7 8 9 10
+48 10 11 12 13 14 15 16 2 14 15 16 17 18 19 20 6 11 12 13 14 15 16 17
+49 17 18 19 20 21 22 23 3 21 22 23 24 25 26 27 7 18 19 20 21 22 23 24
+50 24 25 26 27 28 29 30 4 28 29 30 31 8 25 26 27 28
+51 31
--- /dev/null
+#!/bin/bash
+
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="January 1753"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_CMD_CAL"
+
+export TERM=linux
+
+USETERM=$( ts_has_option "useterm" "$*" )
+MYMONTH="1 1753"
+
+[ "$USETERM" == "yes" ] && TS_VERBOSE="yes"
+ts_log ""
+
+ts_log "Monday-based 1753 week numbers"
+if [ "$USETERM" == "yes" ]; then
+ $TS_CMD_CAL -m3w $MYMONTH
+fi
+$TS_CMD_CAL -m3w $MYMONTH >> $TS_OUTPUT
+
+ts_log "Sunday-based 1753 week numbers"
+if [ "$USETERM" == "yes" ]; then
+ $TS_CMD_CAL -3w $MYMONTH
+fi
+$TS_CMD_CAL -3w $MYMONTH >> $TS_OUTPUT
+
+ts_finalize