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
value
DateOnlyThe DateOnly value to convert
minBound
DateOnlyThe minimum bound of the source range
maxBound
DateOnlyThe 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
percentage
doubleThe percentage value (0.0 to 1.0)
minBound
DateOnlyThe minimum bound of the target range
maxBound
DateOnlyThe 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