diff --git a/src/Humanizer/DateHumanizeExtensions.cs b/src/Humanizer/DateHumanizeExtensions.cs
index e1d4bd5fa..4948b092b 100644
--- a/src/Humanizer/DateHumanizeExtensions.cs
+++ b/src/Humanizer/DateHumanizeExtensions.cs
@@ -19,7 +19,7 @@ public static class DateHumanizeExtensions
/// distance of time in words
public static string Humanize(this DateTime input, bool? utcDate = null, DateTime? dateToCompareAgainst = null, CultureInfo culture = null)
{
- var comparisonBase = dateToCompareAgainst.HasValue ? dateToCompareAgainst.Value : DateTime.UtcNow;
+ var comparisonBase = dateToCompareAgainst ?? DateTime.UtcNow;
utcDate ??= input.Kind != DateTimeKind.Local;
comparisonBase = utcDate.Value ? comparisonBase.ToUniversalTime() : comparisonBase.ToLocalTime();
@@ -89,8 +89,7 @@ public static string Humanize(this DateTimeOffset? input, DateTimeOffset? dateTo
/// distance of time in words
public static string Humanize(this DateOnly input, DateOnly? dateToCompareAgainst = null, CultureInfo culture = null)
{
- var comparisonBase = dateToCompareAgainst.HasValue ? dateToCompareAgainst.Value : DateOnly.FromDateTime(DateTime.UtcNow);
-
+ var comparisonBase = dateToCompareAgainst ?? DateOnly.FromDateTime(DateTime.UtcNow);
return Configurator.DateOnlyHumanizeStrategy.Humanize(input, comparisonBase, culture);
}
@@ -123,7 +122,7 @@ public static string Humanize(this DateOnly? input, DateOnly? dateToCompareAgain
/// distance of time in words
public static string Humanize(this TimeOnly input, TimeOnly? timeToCompareAgainst = null, bool useUtc = true, CultureInfo culture = null)
{
- var comparisonBase = timeToCompareAgainst.HasValue ? timeToCompareAgainst.Value : TimeOnly.FromDateTime(useUtc ? DateTime.UtcNow : DateTime.Now);
+ var comparisonBase = timeToCompareAgainst ?? TimeOnly.FromDateTime(useUtc ? DateTime.UtcNow : DateTime.Now);
return Configurator.TimeOnlyHumanizeStrategy.Humanize(input, comparisonBase, culture);
}