IsoWeekDateStrategy Class
Definition
- Namespace
- Bodu.Globalization.Calendar.Algorithms
- Assembly
- Bodu.Globalization.Calendar.dll
- Package
- Bodu.Globalization.Calendar 1.0.1
- Source
- IsoWeekDateStrategy.cs
Calculates a weekday within an ISO-8601 week of an ISO week-year, such as the Monday of ISO week 1 or the Friday of ISO week 20.
public sealed class IsoWeekDateStrategy : IDateCalculationStrategy
- Inheritance
-
IsoWeekDateStrategy
- Implements
- Inherited Members
- Extension Methods
Remarks
The year supplied to Calculate(int, StrategyResolutionContext) is interpreted as the ISO week-year, so a valid result can fall in the previous or following Gregorian calendar year. ISO week 53 is valid only for ISO years that contain 53 weeks; a week-53 request for a 52-week year produces no occurrence.
// The Monday of ISO week 1.
var strategy = new IsoWeekDateStrategy(1, DayOfWeek.Monday);
Constructors
IsoWeekDateStrategy(int, DayOfWeek)
Initializes a new instance of the IsoWeekDateStrategy class.
public IsoWeekDateStrategy(int week, DayOfWeek dayOfWeek)
Parameters
Exceptions
- ArgumentOutOfRangeException
weekis not between 1 and 53, ordayOfWeekis not a defined DayOfWeek.
Properties
DayOfWeek
Gets the weekday within the ISO week.
public DayOfWeek DayOfWeek { get; }
Property Value
- DayOfWeek
The target weekday.
Week
Gets the one-based ISO-8601 week number.
public int Week { get; }
Property Value
- int
The ISO week.
Methods
Calculate(int, StrategyResolutionContext)
Calculates the occurrence of the notable date in the supplied Gregorian year.
public DateOnly? Calculate(int year, StrategyResolutionContext context)
Parameters
yearintThe Gregorian year in which to calculate the occurrence.
contextStrategyResolutionContextThe resolution context used by referential strategies to resolve other rules.
Returns
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |