WeekdayStrategy

@Serializable
@SerialName(value = "weekday")
data class WeekdayStrategy(val allowedDays: Set<DayOfWeek>, val timezone: TimeZone = TimeZone.UTC, clock: Clock = Clock.System) : FlippingStrategy(source)

A strategy that enables a feature only on specific days of the week.

The feature is enabled when the current day (in the specified timezone) matches one of the allowed days.

This strategy is useful for:

  • Weekday-only features

  • Weekend promotions

  • Scheduled maintenance windows on specific days

See also

for hour-based enabling

for absolute time range enabling

Constructors

Link copied to clipboard
constructor(allowedDays: Set<DayOfWeek>, timezone: TimeZone = TimeZone.UTC, clock: Clock = Clock.System)

Properties

Link copied to clipboard
val allowedDays: Set<DayOfWeek>

The set of days on which the feature is enabled.

Link copied to clipboard
val timezone: TimeZone

The timezone used to determine the current day. Defaults to TimeZone.UTC.

Functions

Link copied to clipboard

Combines this strategy with other using logical AND.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open suspend override fun evaluate(featureId: String, store: FeatureStore?, context: FlippingExecutionContext): Boolean

Evaluates whether the feature should be enabled based on the execution context.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Negates this strategy.

Link copied to clipboard

Combines this strategy with other using logical OR.