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

Fix mark weekday option for monday or sunday #69

Merged
merged 1 commit into from
Mar 8, 2019
Merged
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
3 changes: 2 additions & 1 deletion KDCalendar/CalendarView/CalendarView+DataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ extension CalendarView: UICollectionViewDataSource {

if self.marksWeekends {
let we = indexPath.item % 7
dayCell.isWeekend = we == 5 || we == 6
let weekDayOption = CalendarView.Style.firstWeekday == .sunday ? 0 : 5
dayCell.isWeekend = we == weekDayOption || we == 6
}

if let eventsForDay = self.eventsByIndexPath[indexPath] {
Expand Down
4 changes: 2 additions & 2 deletions KDCalendar/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class ViewController: UIViewController, CalendarViewDataSource, CalendarViewDele
CalendarView.Style.cellEventColor = UIColor(red:1.00, green:0.63, blue:0.24, alpha:1.00)
CalendarView.Style.headerTextColor = UIColor.white
CalendarView.Style.cellTextColorDefault = UIColor.white
CalendarView.Style.cellTextColorToday = UIColor(red:0.31, green:0.44, blue:0.47, alpha:1.00)
CalendarView.Style.cellTextColorToday = UIColor.orange

CalendarView.Style.firstWeekday = .monday
CalendarView.Style.firstWeekday = .sunday

calendarView.dataSource = self
calendarView.delegate = self
Expand Down