You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: SCHEDULE_BETWEEN_DAYS_OF_WEEK stops matching when LC_TIME is not English #8706
A SCHEDULE_BETWEEN_DAYS_OF_WEEK rule with "DAYS": ["FRIDAY"] matches on Fridays whatever locale the function runs with.
Current Behaviour
compare_days_of_week gets the current day with strftime("%A").upper(), which names the day in the process's LC_TIME locale. If the function calls locale.setlocale(locale.LC_TIME, ...) (or LC_ALL) for a non-English locale, the day comes back as FREITAG, VENDREDI, etc., never equals the English names the schema requires, and every day-of-week rule silently stops matching.
Code snippet
importlocalefromaws_lambda_powertools.utilities.feature_flags.comparatorsimportcompare_days_of_weekcond= {"DAYS": ["FRIDAY"], "TIMEZONE": "UTC"} # run on a Fridaycompare_days_of_week(None, cond) # Truelocale.setlocale(locale.LC_TIME, "de_DE.UTF-8")
compare_days_of_week(None, cond) # False, the current day is "FREITAG"
Steps to Reproduce
Configure a feature flag rule with SCHEDULE_BETWEEN_DAYS_OF_WEEK and today's day in DAYS.
Set a non-English LC_TIME in the function.
Evaluate the flag: the rule no longer matches.
Possible Solution
Look the day up from datetime.weekday() (Monday is 0) instead of formatting its name, so the result does not depend on the locale. I can open a PR.
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out our GitHub Discussions: Join the conversation
Thanks @anishmehta24, confirmed with de_DE here, the day comes back as FREITAG. Honestly most people never touch the locale in Lambda, but comparing against weekday() is the right thing anyway. I'll review #8707. Goes into 3.40.0.
Activity
boring-cyborg commentedon Oct 30, 2026
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link
powertools-for-aws-oss-automation commentedon Oct 30, 2026
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out our GitHub Discussions: Join the conversation
leandrodamascena commentedon Oct 30, 2026
Thanks @anishmehta24, confirmed with
de_DEhere, the day comes back asFREITAG. Honestly most people never touch the locale in Lambda, but comparing againstweekday()is the right thing anyway. I'll review #8707. Goes into 3.40.0.