Last active
August 29, 2015 14:07
-
-
Save kureikei/0e498e358c002005b690 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
var t = new Date(); | |
var count = new Date(t.getFullYear(), t.getMonth() + 1, 0).getDate(); | |
var offset = new Date(t.getFullYear(), t.getMonth(), 1).getDay(); | |
var body = ""; | |
for (var i = 0; i < offset; i++) { | |
body += " "; | |
} | |
for (var i = 1; i <= count; i++) { | |
body += (" " + i).slice(-2); | |
body += ((i + offset) % 7 == 0) ? "\n" : " "; | |
} | |
console.log(body); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment