Skip to content

Commit

Permalink
Add getBroadcastYearIntervalFromYear
Browse files Browse the repository at this point in the history
  • Loading branch information
velocityzen committed Jul 17, 2023
1 parent 06202b6 commit a42658d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ Set of functions that return broadcast dates `Interval` for a given date.
- **getBroadcastMonthInterval(date: DateTime): null | Interval**
- **getBroadcastQuarterInterval(date: DateTime): null | Interval**
- **getBroadcastYearInterval(date: DateTime): null | Interval**
- **getBroadcastYearIntervalFromYear(year: number): null | Interval**
- **getBroadcastQuarterIntervalFromYearQuarter({ year, quarter, }: YearQuarter): null | Interval**

- **getBroadcastWeeksInInterval(interval: Interval): null | Interval[]**
Expand Down
8 changes: 8 additions & 0 deletions src/interval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ export function getBroadcastYearInterval(date: DateTime): null | Interval {
return Interval.fromDateTimes(start, end);
}

export function getBroadcastYearIntervalFromYear(
year: number
): null | Interval {
return getBroadcastYearInterval(
DateTime.fromObject({ year, month: 7, day: 1 }, { zone: BroadcastTimeZone })
);
}

const QUARTER_TO_MONTH: Record<number, number> = {
1: 2,
2: 5,
Expand Down

0 comments on commit a42658d

Please sign in to comment.