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

modify selected dates array #14

Open
antons81 opened this issue Apr 8, 2016 · 3 comments
Open

modify selected dates array #14

antons81 opened this issue Apr 8, 2016 · 3 comments

Comments

@antons81
Copy link

antons81 commented Apr 8, 2016

Hi, the issues is, while I am creating calendar controller and providing an array with already selected dates. Than I need to remove some dates from this array and save again calendar with new array of dates. But you not removing no needed dates from current array and adding another the same 2 dates and not modifying current array

this is array from delegate
I have provided these dates 2016-04-10 21:00:00 +0000, 2016-04-12 21:00:00 +0000 than clicked again to remove it and get this one
[2016-04-10 21:00:00 +0000, 2016-04-12 21:00:00 +0000, 2016-04-10 21:00:00 +0000, 2016-04-12 21:00:00 +0000]

@ipraba
Copy link
Owner

ipraba commented Apr 21, 2016

I quite cant understand your issue. Can you please elaborate more
How are you removing the dates? Can you provide some code?

@antons81
Copy link
Author

antons81 commented May 3, 2016

I mean by that, that you are not modifying current array while selecting dates.
I create EPCalendar Picker with predefined dates array.
Than I need edit dates and remove some dates and add new dates than click on done and delegate logs tell me that old dates still in the array + new dates I selected

@dylankbuckley
Copy link

This is what I think you are trying to do:

  1. Initialise calendar with an array of provided dates
  2. You then open the calendar and select / deselect dates
  3. On closing the calendar you call the delegate method:
    @objc optional func epCalendarPicker(_: EPCalendarPicker, didSelectMultipleDate dates : [Date])
  4. In theory, if I understand you correctly you now have two arrays of Date objects and you just want to know what ones have been removed and which ones have been added?
  5. You could loop through items in new array and use the contains() function on the initial array to see if they are in there or not. If they aren't then they are added, and doing it the other way round will give you the dates that have been removed.

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

3 participants