Day |
The DayRangePeriod type exposes the following members.
Name | Description | |
---|---|---|
![]() | DayRangePeriod | Constructs a DayRangePeriod object that specifies the period covered by dayRange. |
Name | Description | |
---|---|---|
![]() | DayRange | Gets the DayRange that specifies the day(s) that this period covers. |
![]() | MinimumDayRange | Returns the minimum day range that was specified using WithMinimumDayRange(DayRange), or null if no such minimum range was specified. |
Name | Description | |
---|---|---|
![]() | Equals |
Two Period objects are equal if it can be ascertained that
they will always represent the same period in time as each other when
compared at the same time and in the same context.
(Inherited from Period) |
![]() | GetHashCode |
Overridden to ensure consistency with Equals.
(Inherited from Period) |
![]() | ToString |
Returns a non-null, non-empty string representation of this instance for logging and debugging purposes.
(Overrides ObjectToString) |
![]() | WithMinimumDayRange | Returns a new DayRangePeriod with the same DayRange as this, but also specifying minimumDayRange as the minimum range required. |
If the boundaries of a DayRangePeriod line up neatly with the date splitting of a Breakdown that contains it, then the calculated data will cover the specified range exactly (or a subset of that range if there isn't enough data to satisfy the request fully). This will always be the case if the period is contained within a DailyBreakdown.
If you put a DayRangePeriod inside a WeeklyBreakdown, MonthlyBreakdown, YearlyBreakdown, or FullYearsAverageBreakdown, then it is up to you whether you ensure that the boundaries of your period line up neatly with the weekly/monthly/yearly splitting of the breakdown. If your period specifies dates that do line up with the breakdown, then those dates will be treated as an exact specification. If your period specifies dates that don't line up with the breakdown, the API will effectively widen the range (at the beginning, or the end, or both boundaries if necessary) to ensure that the returned data covers all the dates that your range specifies (assuming enough data exists to do this).
The following examples should help to make this clearer:
DayRangePeriod period = Period.DayRange(new Day(2025, 2, 19).To(2025, 3, 5)); DatedBreakdown breakdown = DatedBreakdown.Monthly(period);
In this example you can see that the dates of the period (2025-02-19 to 2025-03-05) do not match up with the calendar months that the MonthlyBreakdown specifies. In this instance the API would widen the range at both the beginning and the end, attempting to return one monthly value for February 2025 and one for March 2025.
If the first day of the specified period was the first day of a breakdown month (e.g. 2025-02-01), the range would not have been widened at the start. Similarly, if the last day of the specified period was the last day of a breakdown month (e.g. 2025-03-31), the range would not have been widened at the end. Widening only occurs when the dates don't line up with the splitting of the breakdown.
Day singleDay = new Day(2024, 10, 21); DayRangePeriod period = Period.DayRange(singleDay.To(singleDay)); DatedBreakdown breakdown = DatedBreakdown.Yearly(period);
In this example the period is specified to cover just one day: 2024-10-21. Of course, that period, if interpreted explicitly, is not long enough to allow a yearly breakdown.
In this instance the API would widen the range at the beginning and the end, giving 2024-01-01 to 2024-12-31, so that it could return a yearly value for 2024 (the year containing the specified range).