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

Temp #1

Merged
merged 3 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ The default precision is set to .75 but you can pass your desired precision too.
104 seconds => one minute ago/from now
105 seconds => two minutes ago/from now

25 days => a month ago/from now
25 days => a month ago/from today
```

**No dehumanization for dates as `Humanize` is a lossy transformation and the human friendly date is not reversible**
Expand Down
22 changes: 11 additions & 11 deletions src/Humanizer.Tests.Shared/DateHumanizeDefaultStrategyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void HoursFromNow(int hours, string expected)

[Theory]
[InlineData(38, "tomorrow")]
[InlineData(40, "2 days from now")]
[InlineData(40, "2 days from today")]
public void HoursFromNowNotTomorrow(int hours, string expected)
{
//Only test with injected date, as results are dependent on time of day
Expand All @@ -98,9 +98,9 @@ public void DaysAgo(int days, string expected)

[Theory]
[InlineData(1, "tomorrow")]
[InlineData(10, "10 days from now")]
[InlineData(27, "27 days from now")]
[InlineData(32, "one month from now")]
[InlineData(10, "10 days from today")]
[InlineData(27, "27 days from today")]
[InlineData(32, "one month from today")]
public void DaysFromNow(int days, string expected)
{
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future);
Expand All @@ -117,10 +117,10 @@ public void MonthsAgo(int months, string expected)
}

[Theory]
[InlineData(1, "one month from now")]
[InlineData(10, "10 months from now")]
[InlineData(11, "11 months from now")]
[InlineData(12, "one year from now")]
[InlineData(1, "one month from today")]
[InlineData(10, "10 months from today")]
[InlineData(11, "11 months from today")]
[InlineData(12, "one year from today")]
public void MonthsFromNow(int months, string expected)
{
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future);
Expand All @@ -135,8 +135,8 @@ public void YearsAgo(int years, string expected)
}

[Theory]
[InlineData(1, "one year from now")]
[InlineData(2, "2 years from now")]
[InlineData(1, "one year from today")]
[InlineData(2, "2 years from today")]
public void YearsFromNow(int years, string expected)
{
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future);
Expand Down Expand Up @@ -164,7 +164,7 @@ public void Nullable_ExpectSame()
}

[Theory]
[InlineData(1, TimeUnit.Year, Tense.Future, "en-US", "one year from now")]
[InlineData(1, TimeUnit.Year, Tense.Future, "en-US", "one year from today")]
[InlineData(40, TimeUnit.Second, Tense.Past, "ru-RU", "40 секунд назад")]
[InlineData(2, TimeUnit.Day, Tense.Past, "sv-SE", "för 2 dagar sedan")]
public void CanSpecifyCultureExplicitly(int unit, TimeUnit timeUnit, Tense tense, string culture, string expected)
Expand Down
2 changes: 1 addition & 1 deletion src/Humanizer.Tests.Shared/DateOnlyHumanizeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void DefaultStrategy_MonthApart()
var inputTime = new DateOnly(2015, 08, 05);
var baseTime = new DateOnly(2015, 07, 05);

const string expectedResult = "one month from now";
const string expectedResult = "one month from today";
var actualResult = inputTime.Humanize(baseTime);

Assert.Equal(expectedResult, actualResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ public void HoursAgo(int hours, string expected)
[InlineData(18, "tomorrow")]
[InlineData(24, "tomorrow")]
[InlineData(41, "tomorrow")]
[InlineData(42, "2 days from now")]
[InlineData(48, "2 days from now")]
[InlineData(60, "2 days from now")]
[InlineData(42, "2 days from today")]
[InlineData(48, "2 days from today")]
[InlineData(60, "2 days from today")]
public void HoursFromNow(int hours, string expected)
{
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future, DefaultPrecision);
Expand All @@ -134,13 +134,13 @@ public void DaysAgo(int days, string expected)

[Theory]
[InlineData(1, "tomorrow")]
[InlineData(10, "10 days from now")]
[InlineData(20, "20 days from now")]
[InlineData(22, "22 days from now")]
[InlineData(23, "one month from now")]
[InlineData(31, "one month from now")]
[InlineData(43, "one month from now")]
[InlineData(53, "2 months from now")]
[InlineData(10, "10 days from today")]
[InlineData(20, "20 days from today")]
[InlineData(22, "22 days from today")]
[InlineData(23, "one month from today")]
[InlineData(31, "one month from today")]
[InlineData(43, "one month from today")]
[InlineData(53, "2 months from today")]
public void DaysFromNow(int days, string expected)
{
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future, DefaultPrecision);
Expand All @@ -160,13 +160,13 @@ public void MonthsAgo(int months, string expected)
}

[Theory]
[InlineData(1, "one month from now")]
[InlineData(8, "8 months from now")]
[InlineData(9, "one year from now")]
[InlineData(12, "one year from now")]
[InlineData(19, "one year from now")]
[InlineData(21, "2 years from now")]
[InlineData(24, "2 years from now")]
[InlineData(1, "one month from today")]
[InlineData(8, "8 months from today")]
[InlineData(9, "one year from today")]
[InlineData(12, "one year from today")]
[InlineData(19, "one year from today")]
[InlineData(21, "2 years from today")]
[InlineData(24, "2 years from today")]
public void MonthsFromNow(int months, string expected)
{
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future, DefaultPrecision);
Expand All @@ -181,8 +181,8 @@ public void YearsAgo(int years, string expected)
}

[Theory]
[InlineData(1, "one year from now")]
[InlineData(2, "2 years from now")]
[InlineData(1, "one year from today")]
[InlineData(2, "2 years from today")]
public void YearsFromNow(int years, string expected)
{
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future, DefaultPrecision);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void DaysAgo(int days, string expected)
[Theory]
[InlineData(1, "في غضون يوم واحد من الآن")]
[InlineData(2, "في غضون يومين من الآن")]
[InlineData(10, "في غضون 10 أيام من الآن")]
[InlineData(10,"في غضون 10 يوم من اليوم")]
[InlineData(17, "في غضون 17 يوم من الآن")]
public void DaysFromNow(int days, string expected)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void DaysAgo(int days, string expected)

[Theory]
[InlineData(1, "besok")]
[InlineData(10, "10 hari dari sekarang")]
[InlineData(10, "10 hari dari hari ini")]
public void DaysFromNow(int days, string expected)
{
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future);
Expand All @@ -82,7 +82,7 @@ public void MonthsAgo(int months, string expected)

[Theory]
[InlineData(1, "sebulan dari sekarang")]
[InlineData(10, "10 bulan dari sekarang")]
[InlineData(10, "10 bulan dari hari ini")]
public void MonthsFromNow(int months, string expected)
{
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future);
Expand Down
Loading