-
-
Save kureikei/31eff376619bc54d6425 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
void main() { | |
var today = new DateTime.now(); | |
var calendar = new List.generate(6, (i) => new List.filled(7, " ")); | |
for (var i = 1, week = 0; i <= new DateTime(today.year, today.month + 1, 0).day; i++) { | |
var day = new DateTime(today.year, today.month, i); | |
calendar[week][day.weekday % 7] += i.toString(); | |
if (day.weekday == DateTime.SATURDAY) week++; | |
} | |
print(calendar.where((w) => w.any((d) => d.trim() != "")).map( | |
(w) => w.map((d) => d.substring(d.length - 2)).join(" ")).join("\r\n")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment