How can we help?

Can you schedule a flag?

LaunchDarkly does not have a built in way to schedule a flag for a particular date, however this can be achieved with targeting rules. For example, you may want to serve true to show your feature, but only after November 19th, 2018.

You can use the before/after operator to compare dates in your targeting rules. You'll simply need to include the current date as a custom attribute in your user object and then set up a targeting rule that evaluates to true if the date value in your user object is after the date specified in your targeting rule. Note that dates must be formatted in unix milliseconds for date comparisons. You can reference this in our documentation here

Here's an example in JavaScript showing how to include the current date in unix milliseconds in your user object:

var user = {
"key": "67yx27g7fxl004483",
"custom": {
"current_date": new Date().getTime()
}
};

And here's a screenshot showing how the targeting rule would look in the UI:

This example user will evaluate to `true` because their current date attribute is after the date specified in the flag's targeting rules.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request