Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeAgoSinceDate returns "yesterday" when it should be "day before yesterday" #47

Closed
ebekebe opened this issue Dec 19, 2014 · 7 comments

Comments

@ebekebe
Copy link

ebekebe commented Dec 19, 2014

I found that the timeAgoSinceDate method does not return the correct day. For [yesterday22h timeAgoSinceDate:tomorrow1h] I expected something like "the day before yesterday", but instead "yesterday" was returned, which is wrong.

I use German localization, so the actual example looks like this:

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];

NSDate* yesterday2h = [dateFormat dateFromString:@"2000-01-31 02:00:00"];
NSDate* tomorrow1h = [dateFormat dateFromString:@"2000-02-02 01:00:00"];

XCTAssertNotEqualObjects([yesterday2h timeAgoSinceDate:tomorrow1h], @"Gestern");

I use DateTools 1.4.3.

@marcferna
Copy link
Contributor

+1

@mythodeia
Copy link

just saw that with the latest commit the result is the same.

@marcferna
Copy link
Contributor

I'm using the latest pod version. I'm working on a fix now

marcferna added a commit to marcferna/DateTools that referenced this issue Apr 17, 2015
marcferna added a commit to marcferna/DateTools that referenced this issue Apr 17, 2015
marcferna added a commit to marcferna/DateTools that referenced this issue Apr 17, 2015
@marcferna
Copy link
Contributor

You can check my fix: #74

@mythodeia
Copy link

@marcferna does this fix apply to
- (NSString *)shortTimeAgoSinceDate:(NSDate *)date{
as well?

@marcferna
Copy link
Contributor

I forgot about shortTimeAgoSinceDate but now it includes it.

@mythodeia
Copy link

👍

MatthewYork added a commit that referenced this issue May 27, 2015
Fix yesterday being 2 days ago. Fixes #47.

Thank you!
JaviLorbada added a commit to JaviLorbada/DateTools that referenced this issue Jul 12, 2015
* upstream/master:
  Update README.md
  - Fixed polish translation
  - Updated pod spec
  Removes the DateTools source from the test project's test bundle.
  Makes the localization bundle load from frameworks.
  - Fixing bug that crashes unit tests. Will remove if we can prove it works
  Fixed Polish translation
  Fixed typo on the pt-PT translations.
  Added Croatian localization
  update the "week" translation
  Fix yesterday being 2 days ago. Fixes MatthewYork#47.
  [DT-56]: Updates the macro to safely locate the localization bundle.
  - Added date parsing methods
  updated readme
  fix for "Compiler error 'unknown type name NSInteger'" (issue MatthewYork#52)
jerryen pushed a commit to jerryen/DateTools that referenced this issue Jul 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants