Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for #1158 and #1310 #1312

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@ import JTAppleCalendar

class TestYearViewViewController: UIViewController {
@IBOutlet var calendarView: JTACYearView!
@IBOutlet var scrollToTodayButton: UIButton!
@IBOutlet var monthSelectLabel: UILabel!
let f = DateFormatter()

override func viewDidLoad() {
calendarView.calendarDataSource = self
calendarView.calendarDelegate = self
super.viewDidLoad()
self.monthSelectLabel.text = "Click to select month"
}

@IBAction func scrollToToday(_ sender: UIButton) {
calendarView.scrollToDate(Date(), at: .top , animated: true)
}

}


Expand Down Expand Up @@ -95,6 +103,14 @@ extension TestYearViewViewController: JTACYearViewDelegate, JTACYearViewDataSour
return CGSize(width: width, height: height)
}
}

func calendar(_ calendar: JTACYearView, didSelectMonth month: Month, dateRange: (start: Date, end: Date), cell: JTACMonthCell?, indexPath: IndexPath) {
let formatter1 = DateFormatter()
formatter1.dateFormat = "MMM YYYY"
let formatter2 = DateFormatter()
formatter2.dateFormat = "dd-MMM-YYYY"
self.monthSelectLabel.text = "Selected Month \(formatter1.string(from: dateRange.start))\nWith Date Range:\n\(formatter2.string(from: dateRange.start)) to \(formatter2.string(from: dateRange.end))\nFor index Path: \(indexPath)"
}
}


Expand Down
Loading