| | 1 | | using System; |
| | 2 | | namespace ArbitraryExtensions.Core |
| | 3 | | { |
| | 4 | | public static class DateTimeExtensions |
| | 5 | | { |
| | 6 | | /// <summary>Gets the elapsed timespan between the provided value and DateTime.Now</summary> |
| | 7 | | /// <param name="value">the start datetime value</param> |
| | 8 | | /// <param name="endDate">the end datetime</param> |
| | 9 | | /// <returns>elapsed timespan instance</returns> |
| 1 | 10 | | public static TimeSpan Elapsed(this DateTime value, DateTime endDate) => endDate.Subtract(value); |
| | 11 | |
|
| | 12 | | /// <summary>Gets if the input date is between the provided start and end date</summary> |
| | 13 | | /// <param name="currentDate">the input date</param> |
| | 14 | | /// <param name="startDate">the start date</param> |
| | 15 | | /// <param name="endDate">the end date</param> |
| | 16 | | /// <returns>True, if the input date is within the range, else False</returns> |
| | 17 | | public static bool IsInRange(this DateTime currentDate, DateTime startDate, DateTime endDate) |
| 1 | 18 | | => (currentDate >= startDate && currentDate <= endDate); |
| | 19 | | } |
| | 20 | | } |