Skip to content

XEEDateManager is a class used to quickly generate descriptive string from a given date.

Notifications You must be signed in to change notification settings

decodehq/XEEDateManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Alt text

XEEDateManager

XEEDateManager is a singleton class used to quickly generate descriptive string from a given date.

It converts NSDate objects into strings such as: "2 days from now", "3 weeks ago", "2 minutes from now", "7 months ago". It uses XEEPluralizer for correct pluralization of words ("minute", "hour", "day", "week", "month") in various languages.

Usage

for (int i = 0; i<10; i++) {
        NSTimeInterval timeInterval = arc4random() % 10000000 - 5000000.;
        NSDate* date = [NSDate dateWithTimeIntervalSinceNow:timeInterval];
        NSString* descriptiveDate = [[XEEDateManager sharedManager] descriptiveTimeForDate:date];
        NSLog(@"Described date %@ as: '%@'", date, descriptiveDate);
}

Contact

Follow XEETech on Twitter (XEE Tech).

Connect with us on LinkedIn (@XEE_Tech).

License

XEEPluralizer is available under the MIT license. See the LICENSE file for more info.

About

XEEDateManager is a class used to quickly generate descriptive string from a given date.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published