Most Feature Flag (LaunchDarkly, DevCycle) tools allow you to use numbers as well as booleans (toggles) to evaluate the feature flag. You could use a number as the time the site is going down and use that to evaluate the message to users and then at that time disable the site.
When you didn’t need to have the message you can just disable the Feature Flag so that it doesn’t get evaluated.
I would do something like this:
Create a new Feature Flag called time-of-site-to-go-own and set the value to 1642723544000 (Jan 21, 2022 12:05:44 am GST). Then enable it for all users.
So using the DevCycle React SDK this would look like this:
import { useDVCVariable } from '@devcycle/devcycle-react-sdk'
export default function CountDown() {
const variableKey = 'time-of-site-to-go-down'
const defaultValue = 0
const featureVariable = useDVCVariable(variableKey, defaultValue)
if (featureVariable == null) {
return (<></>);
}
if (featureVariable.value == 0) {
return (<div>Site is up</div>)
}
var currentTime = new Date().getTime()
if (currentTime > featureVariable.value) {
return (<div>Site is down</div>)
}
return (
<div>
The site will shutdown at: { (new Date(featureVariable?.value)).toString() }
</div>
)
}
This would then allow your Product Manager to enable the FF and set the time when they want to turn shut the site down.