Created
November 1, 2019 13:59
-
-
Save laurent22/bc17315c067ce52d8513e68e9c472ee2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const daysPerMonth = [ | |
31, | |
28, | |
31, | |
30, | |
31, | |
30, | |
31, | |
31, | |
30, | |
31, | |
30, | |
31, | |
]; | |
function twoDigits(d) { | |
if (d < 10) return '0' + d; | |
return d.toString(); | |
} | |
const daysPerLine = 10; | |
const lines = []; | |
for (let month = 1; month <= 12; month++) { | |
const days = daysPerMonth[month - 1]; | |
let line = []; | |
for (let day = 1; day <= days; day++) { | |
if (line.length >= daysPerLine && day !== 31) { | |
lines.push(line); | |
line = []; | |
} | |
line.push(twoDigits(day) + ' ' + twoDigits(month)); | |
} | |
if (line.length) lines.push(line); | |
} | |
let lineNum = 80; | |
for (const line of lines) { | |
console.info(lineNum + ' DATA ' + line.join(',')); | |
lineNum += 10; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment