Table of Contents

CalculatedEndDateDurationDefinition Class

Definition

Namespace
Bodu.Globalization.Calendar
Assembly
Bodu.Globalization.Calendar.dll
Package
Bodu.Globalization.Calendar 1.0.1
Source
CalculatedEndDateDurationDefinition.cs

Represents an occurrence duration whose end date is calculated by a second date strategy, producing a span that can vary in length from year to year and can cross a civil-year boundary.

public sealed record CalculatedEndDateDurationDefinition : NotableDateDurationDefinition, IEquatable<NotableDateDurationDefinition>, IEquatable<CalculatedEndDateDurationDefinition>
Inheritance
CalculatedEndDateDurationDefinition
Implements
Inherited Members
Extension Methods

Remarks

The end strategy is evaluated relative to each resolved start occurrence: for the start anchor's civil year, and, when that yields no acceptable candidate, the immediately following civil year. This models patterns such as a company year-end shutdown that begins the Friday before Boxing Day and ends the Monday after New Year's Day, where the span length differs each year.

The effective start and end are derived by applying StartBoundary and EndBoundary to the resolved anchors. When the resulting span is shorter than one day, or no acceptable end anchor exists in the permitted two-year window, the occurrence is not emitted.

Constructors

CalculatedEndDateDurationDefinition(IDateCalculationStrategy, DateBoundary, DateBoundary, EndDateSelection)

Represents an occurrence duration whose end date is calculated by a second date strategy, producing a span that can vary in length from year to year and can cross a civil-year boundary.

public CalculatedEndDateDurationDefinition(IDateCalculationStrategy EndStrategy, DateBoundary StartBoundary = DateBoundary.Inclusive, DateBoundary EndBoundary = DateBoundary.Inclusive, EndDateSelection EndSelection = EndDateSelection.FirstOnOrAfterStart)

Parameters

EndStrategy IDateCalculationStrategy

The strategy that calculates the end anchor of the span.

StartBoundary DateBoundary

Whether the start anchor is included in the span.

EndBoundary DateBoundary

Whether the end anchor is included in the span.

EndSelection EndDateSelection

How the end anchor is selected relative to the start anchor.

Remarks

The end strategy is evaluated relative to each resolved start occurrence: for the start anchor's civil year, and, when that yields no acceptable candidate, the immediately following civil year. This models patterns such as a company year-end shutdown that begins the Friday before Boxing Day and ends the Monday after New Year's Day, where the span length differs each year.

The effective start and end are derived by applying StartBoundary and EndBoundary to the resolved anchors. When the resulting span is shorter than one day, or no acceptable end anchor exists in the permitted two-year window, the occurrence is not emitted.

See Also

Properties

EndBoundary

Whether the end anchor is included in the span.

public DateBoundary EndBoundary { get; init; }

Property Value

DateBoundary

EndSelection

How the end anchor is selected relative to the start anchor.

public EndDateSelection EndSelection { get; init; }

Property Value

EndDateSelection

EndStrategy

The strategy that calculates the end anchor of the span.

public IDateCalculationStrategy EndStrategy { get; init; }

Property Value

IDateCalculationStrategy

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

StartBoundary

Whether the start anchor is included in the span.

public DateBoundary StartBoundary { get; init; }

Property Value

DateBoundary

Methods

Deconstruct(out IDateCalculationStrategy, out DateBoundary, out DateBoundary, out EndDateSelection)

public void Deconstruct(out IDateCalculationStrategy EndStrategy, out DateBoundary StartBoundary, out DateBoundary EndBoundary, out EndDateSelection EndSelection)

Parameters

EndStrategy IDateCalculationStrategy
StartBoundary DateBoundary
EndBoundary DateBoundary
EndSelection EndDateSelection

Equals(CalculatedEndDateDurationDefinition?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(CalculatedEndDateDurationDefinition? other)

Parameters

other CalculatedEndDateDurationDefinition

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(NotableDateDurationDefinition?)

Indicates whether the current object is equal to another object of the same type.

public override sealed bool Equals(NotableDateDurationDefinition? other)

Parameters

other NotableDateDurationDefinition

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

PrintMembers(StringBuilder)

protected override bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Operators

operator ==(CalculatedEndDateDurationDefinition?, CalculatedEndDateDurationDefinition?)

public static bool operator ==(CalculatedEndDateDurationDefinition? left, CalculatedEndDateDurationDefinition? right)

Parameters

left CalculatedEndDateDurationDefinition
right CalculatedEndDateDurationDefinition

Returns

bool

operator !=(CalculatedEndDateDurationDefinition?, CalculatedEndDateDurationDefinition?)

public static bool operator !=(CalculatedEndDateDurationDefinition? left, CalculatedEndDateDurationDefinition? right)

Parameters

left CalculatedEndDateDurationDefinition
right CalculatedEndDateDurationDefinition

Returns

bool

Applies to

ProductVersions
.NET8, 10

See Also