-
Notifications
You must be signed in to change notification settings - Fork 71
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
Calendar does not start on current date when including dates from past #9
Comments
Does anyone have a solution to this issue? |
I have a possible solution in my experimental branch: exp1 |
It works great. |
what files were edited and/or needed in order to achieve this? |
Note somehow this experimental code ended up in the master branch. I added ScrollableView in RKScroll, and modified RKViewController as follows: added
added at lines 100 for verticalView, and 119 for horizontalView:
Let me know if this works. |
I forgot the important bit, I replaced ScrollView(.vertical) with ScrollableView(self.$contentOffset) |
@workingDog forgive me. I am new to swift. I am using the original RKManager files in the Raffikian repository. If I add those few lines to those files from their repository will it still work? Or do I need to download your files in order to achieve this |
You need to download my repo. I thought you were asking about what I did to implement this feature in my repo. My answer should have mentioned this, sorry. https://github.com/workingDog/RKCalendar Just download the master branch. |
okay last issue and I promise im done lol. I've got it working! however, your's uses a done button. is there a way to revert that back to onClick of a date to close the calendar? |
no problems ask away. First the done button is really for when you use it on macos. To remove it Then to close when clicking on a date, in RKMonth --> func dateTapped(date: Date) Let me know if this works. |
@workingDog I've been playing with this problem for several days now. So the app I am working on populates a database from Jan 1, 2020 -> 400 days in the future. Through testing, I know those days are populated. When I launch the calendar to select a day, it starts at the current day, but does not let me see into the past and it also has me limited to 11 months into the future. If I select, say July 1, 2020, when I relaunch the calendar I can only see from July 1 to the previous end date. Any ideas? |
@workingDog after rebuilding, I have the correct date range, but now going into the calendar doesn't focus on the selected date. it only goes to the current date 4/6/2020 |
I'm glad you got the range working. As for the focus date, the current behaviour is to start at the current date. I'll investigate on starting on the selected date. In the mean time you could try this: replace Date() with rkManager.selectedDate There maybe some unexpected side effects. |
@workingDog I solved this. Adding rkmManager.selectedDate where you said to works. You just have to assure that rkManager.selected is instantiated before called to RKViewController for the first time. Thank you so much! |
I suspect this is something to do with Lists in SwiftUI, but if you give the start date to the RKManager as a date in the past, the calendar starts at that date. I suspect most users desired behaviour would be the calendar always starts on the current date and then the user scrolls up or down to the section they want?
The text was updated successfully, but these errors were encountered: