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

Disabling past dates #10

Closed
karalarbaris opened this issue Aug 16, 2016 · 7 comments
Closed

Disabling past dates #10

karalarbaris opened this issue Aug 16, 2016 · 7 comments

Comments

@karalarbaris
Copy link

Hello,
Is it possible to select only certain date ranges? In my case I don't want users to be able to select past dates.
Thank you.

@weilsonwonder
Copy link
Owner

Hi, you could implement the protocol after setting delegate to disable dates.

WWCalendarTimeSelectorShouldSelectDate(selector: WWCalendarTimeSelector, date: NSDate) -> Bool

@karalarbaris
Copy link
Author

Thank you @weilsonwonder :)

@RnyG
Copy link

RnyG commented Nov 15, 2016

@weilsonwonder @KaraBar Hey guys, could you explain me how use this method in swift 2? Thanks.

@RnyG
Copy link

RnyG commented Nov 15, 2016

@weilsonwonder @KaraBar
I found it!
func WWCalendarTimeSelectorShouldSelectDate(selector: WWCalendarTimeSelector, date: NSDate) -> Bool {
if date.timeIntervalSinceNow.isSignMinus {
//myDate is earlier than Now (date and time)
return false
} else {
//myDate is equal or after than Now (date and time)
return true
}
}

@Ali-Sher
Copy link

How to change color and Disable of past time i.e Hour and minutes.. any help.

@Mitesh-Mewada
Copy link

hey @RnyG i set your code #10 (comment) its does't work for me can you share me how to set this code, what is isSignMinus facing error how to call this function and where i set that ? swift 4

@seancze
Copy link

seancze commented Jan 26, 2020

Hi @Mitesh-Mewada,

Do try this instead:

  func WWCalendarTimeSelectorShouldSelectDate(_ selector: WWCalendarTimeSelector, date: Date) -> Bool {
       if date.timeIntervalSinceNow.isLess(than: 0) {
           return false
       } else {
           return true
       }
   }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants