Skip to content

Instantly share code, notes, and snippets.

@kureikei
Created October 23, 2014 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kureikei/31eff376619bc54d6425 to your computer and use it in GitHub Desktop.
Save kureikei/31eff376619bc54d6425 to your computer and use it in GitHub Desktop.
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