コード例 #1
0
ファイル: main.go プロジェクト: xyproto/moskus
// List notable days
func notable(cal calendar.Calendar, year int) {
	current := time.Date(year, 1, 1, 0, 0, 0, 0, time.UTC)

	// As long as we are in the same year
	for current.Year() == year {

		if notable, desc, flag := cal.NotableDay(current); notable {
			fmt.Printf("%s %d is at %s (flag: %v)\n", desc, year, current.String()[:10], flag)
		}

		// Advance to the next day
		current = current.AddDate(0, 0, 1)
	}

	fmt.Println()
}
コード例 #2
0
ファイル: main.go プロジェクト: xyproto/moskus
// List all the days of a given month
func datebonanza(cal calendar.Calendar, year int, month time.Month) {
	fmt.Println(month.String(), year)
	fmt.Println("====================")

	current := time.Date(year, month, 1, 0, 0, 0, 0, time.UTC)

	// As long as we are in the same month
	for current.Month() == month {

		if red, desc, flag := cal.RedDay(current); red {
			fmt.Printf("%s is red: %s (flag: %v)\n", current.String()[:10], desc, flag)
		}

		if notable, desc, flag := cal.NotableDay(current); notable {
			fmt.Printf("%s is notable: %s (flag: %v)\n", current.String()[:10], desc, flag)
		}

		// Advance to the next day
		current = current.AddDate(0, 0, 1)
	}
	fmt.Println()
}