Skip to content

Commit

Permalink
Add support to Time Later
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandrorosas committed Dec 21, 2017
1 parent 3e76c39 commit 5857928
Show file tree
Hide file tree
Showing 5 changed files with 516 additions and 51 deletions.
62 changes: 61 additions & 1 deletion DateTools/DateTools/DateTools.bundle/en.lproj/DateTools.strings
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,66 @@
/* No comment provided by engineer. */
"This year" = "This year";

/* No comment provided by engineer. */
"In %d days" = "In %d days";

/* No comment provided by engineer. */
"In %d hours" = "In %d hours";

/* No comment provided by engineer. */
"In %d minutes" = "In %d minutes";

/* No comment provided by engineer. */
"In %d months" = "In %d months";

/* No comment provided by engineer. */
"In %d seconds" = "In %d seconds";

/* No comment provided by engineer. */
"In %d weeks" = "In %d weeks";

/* No comment provided by engineer. */
"In %d years" = "In %d years";

/* No comment provided by engineer. */
"In a minute" = "In a minute";

/* No comment provided by engineer. */
"In an hour" = "In an hour";

/* No comment provided by engineer. */
"Next month" = "Next month";

/* No comment provided by engineer. */
"Next week" = "Next week";

/* No comment provided by engineer. */
"Next year" = "Next year";

/* No comment provided by engineer. */
"Tomorrow" = "Tomorrow";

/* No comment provided by engineer. */
"In 1 year" = "In 1 year";

/* No comment provided by engineer. */
"In 1 month" = "In 1 month";

/* No comment provided by engineer. */
"In 1 week" = "In 1 week";

/* No comment provided by engineer. */
"In 1 day" = "In 1 day";

/* No comment provided by engineer. */
"In 1 hour" = "In 1 hour";

/* No comment provided by engineer. */
"In 1 minute" = "In 1 minute";

/* No comment provided by engineer. */
"In 1 second" = "In 1 second";

/* Short format for */
"%dy" = "%dy"; // year
"%dM" = "%dM"; // month
Expand All @@ -103,4 +163,4 @@
"周四" = "星期四";
"周五" = "星期五";
"周六" = "星期六";
"周日" = "星期日";
"周日" = "星期日";
16 changes: 15 additions & 1 deletion DateTools/DateTools/NSDate+DateTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,24 @@ NSLocalizedStringFromTableInBundle(key, @"DateTools", [NSBundle bundleWithPath:[
- (NSString *)timeAgoSinceDate:(NSDate *)date numericDates:(BOOL)useNumericDates;
- (NSString *)timeAgoSinceDate:(NSDate *)date numericDates:(BOOL)useNumericDates numericTimes:(BOOL)useNumericTimes;


- (NSString *)shortTimeAgoSinceDate:(NSDate *)date;
- (NSString *)weekTimeAgoSinceDate:(NSDate *)date;

#pragma mark - Time Later
+ (NSString*)timeLaterFromDate:(NSDate*)date;
+ (NSString*)shortTimeLaterFromDate:(NSDate*)date;
+ (NSString *)weekTimeLaterFromDate:(NSDate*)date;

- (NSString*)timeLaterFromNow;
- (NSString *)shortTimeLaterFromNow;
- (NSString *)weekTimeLaterFromNow;

- (NSString *)timeLaterFromDate:(NSDate *)date;
- (NSString *)timeLaterFromDate:(NSDate *)date numericDates:(BOOL)useNumericDates;
- (NSString *)timeLaterFromDate:(NSDate *)date numericDates:(BOOL)useNumericDates numericTimes:(BOOL)useNumericTimes;

- (NSString *)shortTimeLaterFromDate:(NSDate *)date;
- (NSString *)weekTimeLaterFromDate:(NSDate *)date;

#pragma mark - Date Components Without Calendar
- (NSInteger)era;
Expand Down
Loading

0 comments on commit 5857928

Please sign in to comment.