DateRangeStrategy

@Serializable
@SerialName(value = "dateRange")
data class DateRangeStrategy(val startDate: Instant, val endDate: Instant, clock: Clock = Clock.System) : FlippingStrategy(source)

A strategy that enables a feature only within a specified time range.

The feature is enabled when the current time is at or after startDate and before endDate (i.e., the range is [startDate, endDate)).

This strategy is useful for:

  • Limited-time promotions or events

  • Scheduled maintenance windows

  • Time-boxed experiments

See also

for enabling a feature after a single date

Constructors

Link copied to clipboard
constructor(startDate: Instant, endDate: Instant, clock: Clock = Clock.System)

Properties

Link copied to clipboard
val endDate: Instant

The instant at which the feature becomes disabled (exclusive).

Link copied to clipboard
val startDate: Instant

The instant from which the feature becomes enabled (inclusive).

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.