diff --git a/ICD.Common.Utils/Extensions/DateTimeExtensions.cs b/ICD.Common.Utils/Extensions/DateTimeExtensions.cs
index 3fe9e92..bb32197 100644
--- a/ICD.Common.Utils/Extensions/DateTimeExtensions.cs
+++ b/ICD.Common.Utils/Extensions/DateTimeExtensions.cs
@@ -34,15 +34,16 @@ namespace ICD.Common.Utils.Extensions
/// Returns the closest DateTime to the target time that is greater than the target time
///
///
+ /// Whether or not to include times equal to the target time
///
///
- public static DateTime? NextEarliestTime(this DateTime target, params DateTime[] times)
+ public static DateTime? NextEarliestTime(this DateTime target, bool inclusive, params DateTime[] times)
{
if (times == null)
throw new ArgumentNullException("times");
DateTime earliestTime;
- bool success = times.OrderBy(dt => dt).TryFirst(dt => target < dt, out earliestTime);
+ bool success = times.OrderBy(dt => dt).TryFirst(dt => inclusive ? target <= dt : target < dt, out earliestTime);
return success ? earliestTime : (DateTime?) null;
}
@@ -50,15 +51,16 @@ namespace ICD.Common.Utils.Extensions
/// Returns the closest DateTime to the target time that is less than the target time
///
///
+ /// Whether or not to include times equal to the target time
///
///
- public static DateTime? PreviousLatestTime(this DateTime target, params DateTime[] times)
+ public static DateTime? PreviousLatestTime(this DateTime target, bool inclusive, params DateTime[] times)
{
if (times == null)
throw new ArgumentNullException("null");
DateTime latestTime;
- bool success = times.OrderByDescending(dt => dt).TryFirst(dt => target > dt, out latestTime);
+ bool success = times.OrderByDescending(dt => dt).TryFirst(dt => inclusive ? target >= dt : target > dt, out latestTime);
return success ? latestTime : (DateTime?) null;
}
}