OCCalendar icon indicating copy to clipboard operation
OCCalendar copied to clipboard

Allow user only to select today's & Future dates, not the past ones

Open Rajputvikassingh opened this issue 13 years ago • 5 comments

Hi Oliver,

Thanks for sharing the component with us. It's really an interesting controller which can be used as Date Picker similar to the iPhone Picker view, but much far better than that considering the look-wise , may be with space or the Animation ,whatever it may be it's far better than controller available for date selections.

I have already implemented this controller instead of using the UIDatePicker in my application. But now facing couple of issues with the Date Selections

  1. I am not able to limit the user for selecting the dates from Present to Future, they should not able to selected the past dates of the months.
  2. Not able to show the last selected dates on the PopOver Calendar.

If we get such options then this may lead for making the excellent controller which still we are missing in iPhoneSDK & overcoming the limitations the Tapku library.

Thanks,

Rajputvikassingh avatar Apr 10 '12 12:04 Rajputvikassingh

Hello,

Thanks for using the controller!

1.) So you'd like to restrict selection dates to a particular range? I suppose that isn't too hard. I'll look into implementing it son.

2.) Good point, something I probably need to implement. What do you think of declaring two parameters within the controller that you can modify after init which will re-draw the selection view with your inputs? Alternatively, it could be part of a new initialization routine...

ocrickard avatar Apr 10 '12 14:04 ocrickard

Thanks for your acknowledgment !!!

  1. Yes, I am looking out to implement the functionality to let user choose the dates from present to future disable the past dates as we do have in UIDatePicker, user would be able to see them but cannot selected.

  2. Hmm... I think whatever the code I have studied according to that, we should be able to achieve by declaring the variables which stores the start & end dates of the selection which need to be drawn on to the Calendar.Probably there is no need to have the new routine for this. And yes, an another alternative for this ,which is quite easy even than storing the dates is :

Just storing the below values from the last selections : (OCSelectionView.m) & get rid of making new routine.

       startCellX = 1;        startCellY = 0;        endCellX = 4;        endCellY = 3;

just changing the status of the BOOL selected        selected = YES; else default none of the date selected will be shown.

Thanks,

Rajputvikassingh avatar Apr 11 '12 05:04 Rajputvikassingh

FYI in my original post I said "son" instead of "soon". Typo. I'm not quite old enough to use that nickname yet... Sorry if it came across as patronizing.

  1. I'll see what I can do in the next week or two. This together with the other good feedback I've received will make for an interesting morning of programming. I've got a ton of work to do in the next week, so I'm not positive when I'll get around to it.
  2. I'm afraid that this controller is built to not remember anything. The controller is not a persistent interface, so I'd prefer not to use remembered values from previous allocations because that would require storing that information either in user defaults, or in the delegate somehow..... However, I believe that adding two NSDate parameters to the controller would function just as well, and would add great flexibility. For instance, it would allow you to set the selected date range that a use had already selected via your web interface.

ocrickard avatar Apr 11 '12 06:04 ocrickard

No worry at all, I looked on that & understood of that being the TYPO. FYI, I am still so young to be called a son ;)

That sounds good.I will also work out on adding more features .If possible I will Hope that will save allot of time of others.

Rajputvikassingh avatar Apr 11 '12 08:04 Rajputvikassingh

Has this ever be done? I am trying to implement this.

ghost avatar Nov 30 '12 23:11 ghost