mirror of https://github.com/oliverbooth/X10D
style!: rename parameter for DateTime.Age and DateTimeOffset.Age
BREAKING CHANGE: "asOf" has been renamed to "referenceDate". Consumers using named parameters beware.
This commit is contained in:
parent
713c55a5b4
commit
a717976229
|
@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## 4.0.0 - [Unreleased]
|
||||
|
||||
### Changed
|
||||
- X10D: `DateTime.Age(DateTime)` and `DateTimeOffset.Age(DateTimeOffset)` parameter renamed from `asOf` to `referenceDate`.
|
||||
|
||||
## [3.2.0] - 2023-04-03
|
||||
|
||||
### Added
|
||||
|
|
|
@ -30,9 +30,9 @@ public static class DateTimeExtensions
|
|||
#else
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
#endif
|
||||
public static int Age(this DateTime value, DateTime asOf)
|
||||
public static int Age(this DateTime value, DateTime referenceDate)
|
||||
{
|
||||
return ((DateTimeOffset)value).Age(asOf);
|
||||
return ((DateTimeOffset)value).Age(referenceDate);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="DateTimeOffsetExtensions.First(DateTimeOffset, DayOfWeek)" />
|
||||
|
|
|
@ -30,10 +30,10 @@ public static class DateTimeOffsetExtensions
|
|||
/// Returns the rounded-down integer number of years since a given date as of another specified date.
|
||||
/// </summary>
|
||||
/// <param name="value">The date from which to calculate.</param>
|
||||
/// <param name="asOf">The date at which to stop calculating.</param>
|
||||
/// <param name="referenceDate">The date to use as the calculation reference.</param>
|
||||
/// <returns>
|
||||
/// The rounded-down integer number of years since <paramref name="value" /> as of the date specified by
|
||||
/// <paramref name="asOf" />.
|
||||
/// <paramref name="referenceDate" />.
|
||||
/// </returns>
|
||||
[Pure]
|
||||
#if NETSTANDARD2_1
|
||||
|
@ -41,9 +41,9 @@ public static class DateTimeOffsetExtensions
|
|||
#else
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
#endif
|
||||
public static int Age(this DateTimeOffset value, DateTimeOffset asOf)
|
||||
public static int Age(this DateTimeOffset value, DateTimeOffset referenceDate)
|
||||
{
|
||||
return (int)(((asOf.Date - TimeSpan.FromDays(1) - value.Date).TotalDays + 1) / 365.2425);
|
||||
return (int)(((referenceDate.Date - TimeSpan.FromDays(1) - value.Date).TotalDays + 1) / 365.2425);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue