0

I would like to remove all weekends from my FSCalendar to show only weekdays. Thank you in advance. So far I manage that I can't pick weekend days from calendar. I would like to that weekends do not show at all

  func calendar(_ calendar: FSCalendar, shouldSelect date: Date, at monthPosition: FSCalendarMonthPosition) -> Bool {
        return CheckSatSunday(today: date)
    }

Disable picking weekedn on calendar

    func CheckSatSunday(today:Date) ->Bool{

        var DayExist:Bool
        // let today = NSDate()

        let calendar =
            NSCalendar(calendarIdentifier:NSCalendar.Identifier.gregorian)
        let components = calendar!.components([.weekday], from: today)

        if components.weekday == 1 {
            print("Sunday")
            DayExist = false
        } else if components.weekday == 7{
            print("Saturday")

            DayExist = false
        } else{
            print("It's not Saturday and  Sunday ")
            DayExist = true
        }
        print("weekday :\(String(describing: components.weekday)) ")
        return DayExist
    }
mindelicious
  • 1
  • 1
  • 3
  • What have you tried so far? Without showing at least some (research) effort, you're highly unlikely to receive an answer. – Dávid Pásztor Jul 17 '19 at 10:14
  • @mindelicious FSCalendar have multiple calendar types. on which calendar are you working ? – Nirav Kotecha Jul 17 '19 at 10:29
  • @NiravKotecha oh i didn't know. Working on calendar from: [Github]:[https://github.com/WenchaoD/FSCalendar]. – mindelicious Jul 17 '19 at 10:51
  • @DávidPásztor so far I manage that I can't pick weekend days from calendar. I will edit my question and add code. I would like to that weekends do not show at all – mindelicious Jul 17 '19 at 10:52

1 Answers1

0

Found this other question about it, but here they refer to weekdays

How to remove days in FSCalendar Swift library

I haven't use the library personally, but I assume that if there is a public weekdays property it should be weekends as well, or at least with this you can figure out a logic to remove days selectively

Samuel Chavez
  • 768
  • 9
  • 12