Configuring a Statsig Feature Flag with Time Constraints

To create a Statsig feature flag that returns true for a specific duration, you need to set the before and after dates correctly. This guide will help you avoid common pitfalls when configuring these time constraints.

Steps to Configure the Feature Flag

  1. Access the Statsig Console: Log in to your Statsig account and navigate to the Feature Flags section.
  2. Create a New Feature Flag: Click on the option to create a new feature flag.
  3. Set Time Constraints: In the configuration settings, you will find options to specify the before and after dates. Make sure to use the correct format:
    • Date Format: Statsig requires dates in the American format: MM/DD/YYYY.
    • Time Format: Use XX:XX AM/PM for specifying time.

Example Configuration

Here’s an example of how your configuration might look:

{
  "name": "my_feature_flag",
  "rules": [
    {
      "condition": {
        "before": "12/31/2023 11:59 PM",
        "after": "12/01/2023 12:00 AM"
      },
      "treatment": "true"
    }
  ]
}

Troubleshooting Common Errors

If you encounter an "invalid error" when saving your configuration, check the following:

  • Ensure that both dates are in the correct format.
  • Verify that the after date is earlier than the before date.

By following these guidelines, you should be able to successfully configure your Statsig feature flag to activate for the desired time period.