naoty / Timepiece

Intuitive date handling in Swift
MIT License
2.63k stars 147 forks source link

Any way to get the beginning of the week easily? #2

Closed adamtootle closed 9 years ago

adamtootle commented 9 years ago

If it's not currently possible, maybe we can add something like

let now = NSDate()
let monday = now.beginningOfWeek

Or possibly

let monday = now.last(NSDate.Monday)

I just had a couple of ideas on how that may look, but wanted to ask if there's was already a way first.

adamtootle commented 9 years ago

Actually, it looks like #1 may do this for me. I'm going to play with .change(). I'll reopen if I have any problems with it. Sorry about that.

naoty commented 9 years ago

Sorry for less documents.