locutus
Version:
Locutus other languages' standard libraries to JavaScript for fun and educational purposes
16 lines (15 loc) • 765 B
JavaScript
import { formatWeek, toCalendarInteger } from "../_helpers/_calendar.js";
export function week(theweek, width) {
// discuss at: https://locutus.io/python/calendar/week/
// parity verified: Python 3.12
// original by: Kevin van Zonneveld (https://kvz.io)
// example 1: week([[26, 0], [27, 1], [28, 2], [29, 3], [0, 4], [0, 5], [0, 6]], 2)
// returns 1: '26 27 28 29 '
if (arguments.length === 0) {
throw new TypeError("formatweek() missing 2 required positional arguments: 'theweek' and 'width'");
}
if (arguments.length === 1) {
throw new TypeError("formatweek() missing 1 required positional argument: 'width'");
}
return formatWeek(theweek, toCalendarInteger(width, 'week'));
}