-
-
Notifications
You must be signed in to change notification settings - Fork 771
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
Create Date/DateInRegion at the next day of the week (ie. "Next Friday" [since ref date]) #214
Comments
We don't support it yet, but seems a nice addition. let components = NSDateComponents()
components.weekday = 1 // in Gregorian 1 is Sunday
let nextSunday = self.calendar.nextDateAfterDate(self.absoluteTime, matchingComponents: components, options: [.MatchNextTimePreservingSmallerUnits]) |
If added then please add to docs that next Friday means the first Friday after today. |
@malcommac Thanks I had since simplified what i was trying to do however I believe that would be a really handy convenience method to offer. I basically wanted my users to create events. Using So my first time using the library, i was playing around trying to create these objects with this syntax //My simplified solution 😂 let today = NSDate()
let day1 = today + 1.days
let day2 = today + 2.days
let day3 = today + 3.days
let day4 = today + 4.days
let day5 = today + 5.days
let day6 = today + 6.days
let day7 = today + 7.days
e.tc.. |
I've scheduled it for 4.1.0. |
@malcommac Dope 🙌 |
Added in 4.0.8 (b9d6cec). Examples: let now = DateInRegion() // 30 nov 2016, 13:55:04 CET
let nextFriday = now.next(day: .friday) // 02 dic 2016, 00:00:00 CET
let nextMonday = now.next(day: .monday) // 05 dic 2016, 00:00:00 CET |
beautiful thanks @malcommac |
Thank you for your suggestion :) |
@malcommac
I'm new to this library so I haven't discovered yet how to create these objects. I couldn't find any direct references in the swift files.
Next Friday
Next Saturday
Next Sunday
The text was updated successfully, but these errors were encountered: