@@ -459,6 +459,8 @@ Use cases:
459
459
* Disable support/chat feature after working hours
460
460
* Launch a new feature on a specific date and time
461
461
462
+ You can also have features enabled only at certain times of the day for premium tier customers
463
+
462
464
=== "app.py"
463
465
464
466
```python hl_lines="12"
@@ -473,7 +475,7 @@ Use cases:
473
475
474
476
=== "features.json"
475
477
476
- ```json hl_lines="15 19-27 "
478
+ ```json hl_lines="9-11 14-21 "
477
479
--8<-- "examples/feature_flags/src/timebased_features.json"
478
480
```
479
481
@@ -491,6 +493,20 @@ You can also have features enabled only at certain times of the day.
491
493
--8<-- "examples/feature_flags/src/timebased_happyhour_features.json"
492
494
```
493
495
496
+ You can also have features enabled only at specific days, for example: enable christmas sale discount during specific dates.
497
+
498
+ === "app.py"
499
+
500
+ ```python hl_lines="10"
501
+ --8<-- "examples/feature_flags/src/datetime_feature.py"
502
+ ```
503
+
504
+ === "features.json"
505
+
506
+ ```json hl_lines="9-14"
507
+ --8<-- "examples/feature_flags/src/datetime_feature.json"
508
+ ```
509
+
494
510
???+ info "How should I use timezones?"
495
511
You can use any [ IANA time zone] ( https://www.iana.org/time-zones ) (as originally specified
496
512
in [ PEP 615] ( https://peps.python.org/pep-0615/ ) ) as part of your rules definition.
@@ -633,7 +649,7 @@ The `conditions` block is a list of conditions that contain `action`, `key`, and
633
649
The ` action ` configuration can have the following values, where the expressions ** ` a ` ** is the ` key ` and ** ` b ` ** is the ` value ` above:
634
650
635
651
| Action | Equivalent expression |
636
- | ------------------------------------- | ---------------------------------------------------------- |
652
+ | ----------------------------------- | -------------------------------------------------------- |
637
653
| ** EQUALS** | ` lambda a, b: a == b ` |
638
654
| ** NOT_EQUALS** | ` lambda a, b: a != b ` |
639
655
| ** KEY_GREATER_THAN_VALUE** | ` lambda a, b: a > b ` |
@@ -657,11 +673,11 @@ The `action` configuration can have the following values, where the expressions
657
673
658
674
For time based keys, we provide a list of predefined keys. These will automatically get converted to the corresponding timestamp on each invocation of your Lambda function.
659
675
660
- | Key | Meaning |
661
- |-------------------------| -------------------------------------------------------------------------- |
662
- | CURRENT_TIME | The current time, 24 hour format (HH:mm) |
663
- | CURRENT_DATETIME | The current datetime ([ISO8601](https://en.wikipedia.org/wiki/ISO_8601)) |
664
- | CURRENT_DAY_OF_WEEK | The current day of the week (Monday-Sunday) |
676
+ | Key | Meaning |
677
+ | ------------------- | ------------------------------------------------------------------------ |
678
+ | CURRENT_TIME | The current time, 24 hour format (HH:mm) |
679
+ | CURRENT_DATETIME | The current datetime ([ISO8601](https://en.wikipedia.org/wiki/ISO_8601)) |
680
+ | CURRENT_DAY_OF_WEEK | The current day of the week (Monday-Sunday) |
665
681
666
682
If not specified, the timezone used for calculations will be UTC.
667
683
0 commit comments