malcommac / SwiftDate

🐔 Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift.
MIT License
7.63k stars 770 forks source link

How to use .toRelative to return "Tomorrow" instead of "in 1 day"? #747

Open 0radek opened 4 years ago

0radek commented 4 years ago

Today is Aug 26 for me, so let's say I have the following:

if let date = "2020-08-27T09:00:00Z".toISODate(region: Region.ISO) {
    let m = date.toRelative(since: DateInRegion(), style: RelativeFormatter.defaultStyle())
    print(m)
}

It will print "in 1 day" or something to that effect. I noticed in the code that it has strings for "Tomorrow", etc. but the documentation for customizing is Coming Soon.

I am wondering then, how can I make it so I can receive "Tomorrow" for things happening in 1 day.

Thanks