-
Notifications
You must be signed in to change notification settings - Fork 444
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
Auto Scheduling Events #671
Comments
Hello! The interval that's specified here determines when the task is repeated, so setting an hour interval means an event shows up every hour. I believe the default duration of the event is around 2 hours. But does the event show up every day? That would be strange since the end date is set to an hour after the start date. The end date is the last time an event will ever show up, not the event end time. What schedule are you trying to achieve? If it is: "An event should occur every day, between 8am and 9am" Then the schedule element would look like: let calendar = Calendar.current
let startOfDay = calendar.startOfDay(for: Date())
let eightInTheMorning = calendar.date(bySettingHour: 8, minute: 0, second: 0, of: startOfDay)!
let element = OCKScheduleElement(
start: eightInTheMorning,
end: nil,
interval: DateComponents(day: 1),
duration: .hours(1)
)
let schedule = OCKSchedule(composing: [element]) (Do note that this schedule will be relative to the time zone in which it was scheduled!) |
Hello @gavirawson-apple, Yes, we want to display that task/event every day like for 1 month so the end date can be set as the last day of the month. I was trying to push the event from the server side every day that's why I was trying to set the same date for both start/end dates. Thanks for sharing the code snippet. I'll use it as you suggested. Just asking for confirmation:
Thank You,
|
Exactly! The end date should after the end of the 15th event and before (or on) the start of the 16th event, that will ensure only 15 events show up.
Similarly, make sure |
Hello @gavirawson-apple,
We're trying to schedule some tasks so that they only appear for a specific time on the app side.
For example, we want people to see a task at 08 o'clock in the morning and remove that task from the app at 09 o'clock. So, it should be displayed before 8 o'clock and after 9 o'clock during that day.
I tried to achieve the goal using the
surveySchedule = OCKScheduleElement(start: thisMorning!, end: expiryDate!, interval: DateComponents(hour: 1) )
Where
thisMorning = 2022-10-07 08:00:00
, andexpiryDate = 2022-10-07 09:00:00
But it didn't work as expected. It appears in the app all the time.
Please advise me on how I can achieve my goal.
Thank You,
The text was updated successfully, but these errors were encountered: