Skip to content

samhann/SwiftDates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftDates

Custom operators to make your date handling code simple and elegant.

Tomorrows Date :

1.days.afterNow()

Date Arithmetic :

var later = NSDate() + 1.hours + 3.minutes + 4.minutes + 3.seconds

var isGreaterThanOneHourOneMinute =  later - NSDate()  > 1.hours + 1.minutes // true

Conversions to duration String:

(NSDate() - later).longString() // "1 hour , 7 minutes and 2 seconds ago"

(later - NSDate()).shortString() // "1 hour from now"

Try it in the playground.

About

Elegant date arithmetic in Swift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages