dailyHoursStrategy

fun FeatureBuilder.dailyHoursStrategy(startHour: Int, endHour: Int, timezone: TimeZone = TimeZone.UTC)(source)

Configures a DailyHoursStrategy for this feature.

The feature will be enabled only during the specified hours of the day. Hours are evaluated in the specified timezone.

Example

feature("business-hours-only") {
dailyHoursStrategy(
startHour = 9,
endHour = 17,
timeZone = TimeZone.of("America/New_York")
)
}

Author

Yonatan Karp-Rudin

Parameters

startHour

The hour when the feature becomes enabled (0-23, inclusive).

endHour

The hour when the feature becomes disabled (1-24, exclusive).

timezone

The timezone to use for hour calculations. Defaults to UTC.

See also

for day-of-week based enabling

Throws

if startHour is not in 0..23, endHour is not in 1..24, or endHour is not greater than startHour.