From a42658dfd49fba9bc3674d5cd290bf2ec3631c9d Mon Sep 17 00:00:00 2001 From: Alexey Novikov Date: Mon, 17 Jul 2023 10:12:15 -0400 Subject: [PATCH] Add getBroadcastYearIntervalFromYear --- README.md | 1 + src/interval.ts | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 2387323..4232c85 100644 --- a/README.md +++ b/README.md @@ -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[]** diff --git a/src/interval.ts b/src/interval.ts index 04387b1..9f20783 100644 --- a/src/interval.ts +++ b/src/interval.ts @@ -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 = { 1: 2, 2: 5,