@@ -416,6 +416,48 @@ def test_time_based_utc_days_range_rule_match(mocker):
416416 )
417417
418418
419+ def test_time_based_days_range_rule_match_with_non_english_locale (mocker ):
420+ # GIVEN a process whose LC_TIME names the days in German, so strftime("%A") on a Friday is "Freitag"
421+ class GermanDatetime (dt .datetime ):
422+ def strftime (self , fmt ):
423+ return super ().strftime (fmt ).replace ("Friday" , "Freitag" )
424+
425+ friday = GermanDatetime (2022 , 11 , 18 , 10 , 0 , 0 , tzinfo = dt .timezone .utc )
426+ mocker .patch (
427+ "aws_lambda_powertools.utilities.feature_flags.comparators._get_now_from_timezone" ,
428+ return_value = friday ,
429+ )
430+ mocked_get_conf = mocker .patch ("aws_lambda_powertools.utilities.parameters.AppConfigProvider.get" )
431+ mocked_get_conf .return_value = {
432+ "my_feature" : {
433+ FEATURE_DEFAULT_VAL_KEY : False ,
434+ RULES_KEY : {
435+ "match only on fridays" : {
436+ RULE_MATCH_VALUE : True ,
437+ CONDITIONS_KEY : [
438+ {
439+ CONDITION_ACTION : RuleAction .SCHEDULE_BETWEEN_DAYS_OF_WEEK .value ,
440+ CONDITION_KEY : TimeKeys .CURRENT_DAY_OF_WEEK .value ,
441+ CONDITION_VALUE : {TimeValues .DAYS .value : [TimeValues .FRIDAY .value ]},
442+ },
443+ ],
444+ },
445+ },
446+ },
447+ }
448+ store = AppConfigStore (
449+ environment = "test_env" ,
450+ application = "test_app" ,
451+ name = "test_conf_name" ,
452+ max_age = 600 ,
453+ sdk_config = Config (region_name = "us-east-1" ),
454+ )
455+
456+ # WHEN evaluating the rule
457+ # THEN the day still matches FRIDAY
458+ assert FeatureFlags (store = store ).evaluate (name = "my_feature" , context = {}, default = False )
459+
460+
419461def test_time_based_utc_days_range_no_rule_match (mocker ):
420462 assert not evaluate_mocked_schema (
421463 mocker = mocker ,
0 commit comments