Class WeekYearRuleExtensions
Extension methods on IWeekYearRule.
Since 1.4.x
Availability net6.0, net8.0, netstandard2.0
Inherited Members
Namespace: NodaTime.Calendars
Assembly: NodaTime.dll
Syntax
public static class WeekYearRuleExtensions
Methods
GetLocalDate(IWeekYearRule, int, int, IsoDayOfWeek)
Convenience method to call GetLocalDate(int, int, IsoDayOfWeek, CalendarSystem)
passing in the ISO calendar system.
Since 1.4.x
Availability net6.0, net8.0, netstandard2.0
Declaration
public static LocalDate GetLocalDate(this IWeekYearRule rule, int weekYear, int weekOfWeekYear, IsoDayOfWeek dayOfWeek)
Parameters
Type | Name | Description |
---|---|---|
IWeekYearRule | rule | The rule to delegate the call to. |
int | weekYear | The week-year of the new date. Implementations provided by Noda Time allow any year which is a valid calendar year, and sometimes one less than the minimum calendar year and/or one more than the maximum calendar year, to allow for dates near the start of a calendar year to fall in the previous week year, and similarly for dates near the end of a calendar year. |
int | weekOfWeekYear | The week of week-year of the new date. Valid values for this parameter
may vary depending on weekYear , as the length of a year in weeks varies. |
IsoDayOfWeek | dayOfWeek | The day-of-week of the new date. Valid values for this parameter may vary
depending on weekYear and weekOfWeekYear . |
Returns
Type | Description |
---|---|
LocalDate | A LocalDate corresponding to the specified values. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The parameters do not combine to form a valid date. |
GetWeeksInWeekYear(IWeekYearRule, int)
Convenience overload to call GetWeeksInWeekYear(int, CalendarSystem) with
the ISO calendar system.
Since 1.4.x
Availability net6.0, net8.0, netstandard2.0
Declaration
public static int GetWeeksInWeekYear(this IWeekYearRule rule, int weekYear)
Parameters
Type | Name | Description |
---|---|---|
IWeekYearRule | rule | The rule to delegate the call to. |
int | weekYear | The week year to calculate the number of contained weeks. |
Returns
Type | Description |
---|---|
int | The number of weeks in the given week year. |