Class DateOnlyExtensions
- Namespace
- Plugin.BaseTypeExtensions
- Assembly
- Plugin.BaseTypeExtensions.dll
Provides extension methods for DateOnly operations, such as range checks and percentage calculations.
public static class DateOnlyExtensions
- Inheritance
-
DateOnlyExtensions
- Inherited Members
Methods
DateOnlyToPercentage(DateOnly, DateOnly, DateOnly)
Converts a DateOnly value within a specified range to a percentage (0.0 to 1.0).
public static double DateOnlyToPercentage(this DateOnly value, DateOnly minBound, DateOnly maxBound)
Parameters
valueDateOnlyThe DateOnly value to convert
minBoundDateOnlyThe minimum bound of the source range
maxBoundDateOnlyThe maximum bound of the source range
Returns
- double
The percentage representation (0.0 to 1.0)
Exceptions
- ArgumentOutOfRangeException
Thrown when minBound is greater than maxBound
PercentageToDateOnly(double, DateOnly, DateOnly)
Converts a percentage (0.0 to 1.0) to a DateOnly value within the specified range.
public static DateOnly PercentageToDateOnly(this double percentage, DateOnly minBound, DateOnly maxBound)
Parameters
percentagedoubleThe percentage value (0.0 to 1.0)
minBoundDateOnlyThe minimum bound of the target range
maxBoundDateOnlyThe maximum bound of the target range
Returns
- DateOnly
The calculated DateOnly value within the specified range
Exceptions
- ArgumentOutOfRangeException
Thrown when minBound is greater than maxBound