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

583 years and months #604

Closed
wants to merge 1 commit into from
Closed

583 years and months #604

wants to merge 1 commit into from

Conversation

reinhardtb
Copy link

@reinhardtb reinhardtb commented Dec 12, 2016

Fixes string resolution of a timespan including years and months

Fixes string resolution of a tiespan including years and months
months += monthCount;

return months;
}
Copy link
Contributor

@aloisdg aloisdg Dec 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to write 142-162 as:

    for (var monthCount = 0; daysRemaining > _daysInMonths[monthCount]; monthCount++)
        daysRemaining -= _daysInMonths[monthCount];
     return isTimeUnitToGetTheMaximumTimeUnit
        ? months + monthCount
        : daysRemaining;

I didnt test it. So feel free to change anything else ;)

return timespan.Days % _daysInAWeek;
}
return (int)(timespan.TotalDays%_daysInAYear);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also

{
    return (int)(isTimeUnitToGetTheMaximumTimeUnit
        ? Math.Floor(timespan.TotalDays / _daysInAYear)
        : timespan.TotalDays % _daysInAYear);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can benefit of ternary operator further 👍

}
private static List<string> CreateTimePartsWithNoTimeValue(string noTimeValue)
{
return new List<string>()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the ()

}
private static bool IsContainingOnlyNullValue(IEnumerable<string> timeParts)
{
return (timeParts.Count(x => x != null) == 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the ( )

Copy link
Member

@hazzik hazzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add some tests?

@@ -8,190 +8,235 @@

namespace Humanizer
{
/// <summary>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem to obey the .editorconfig, stating 4 spaces.

This makes the diff much larger than it's supposed to.

@MehdiK
Copy link
Member

MehdiK commented Nov 4, 2017

@reinhardtb Thanks for the contribution. This has been sitting here idly for about a year now. Could you please address the comments, do a rebase and push force? Please also fix the whitespace diffs as they make it hard to review the code. Please leave us a comment. Thanks.

@MehdiK
Copy link
Member

MehdiK commented Nov 4, 2017

Actually I will close this for now. Please submit a new PR and we'll review.

@MehdiK MehdiK closed this Nov 4, 2017
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

Successfully merging this pull request may close these issues.

5 participants