locutus
Version:
Locutus other languages' standard libraries to JavaScript for fun and educational purposes
19 lines (18 loc) • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.month = month;
const _calendar_ts_1 = require("../_helpers/_calendar.js");
function month(theyear, themonth, w = 0, l = 0) {
// discuss at: https://locutus.io/python/calendar/month/
// parity verified: Python 3.12
// original by: Kevin van Zonneveld (https://kvz.io)
// example 1: month(2024, 2)
// returns 1: ' February 2024\nMo Tu We Th Fr Sa Su\n 1 2 3 4\n 5 6 7 8 9 10 11\n12 13 14 15 16 17 18\n19 20 21 22 23 24 25\n26 27 28 29\n'
if (arguments.length === 0) {
throw new TypeError("TextCalendar.formatmonth() missing 2 required positional arguments: 'theyear' and 'themonth'");
}
if (arguments.length === 1) {
throw new TypeError("TextCalendar.formatmonth() missing 1 required positional argument: 'themonth'");
}
return (0, _calendar_ts_1.formatMonth)((0, _calendar_ts_1.normalizeCalendarYear)(theyear, 'month'), (0, _calendar_ts_1.normalizeCalendarMonth)(themonth, 'month'), (0, _calendar_ts_1.normalizeMonthWidth)(w, 'month'), (0, _calendar_ts_1.normalizeLineSpacing)(l, 'month'));
}