Skip to content

fix(feature_flags): match days of week regardless of locale - #8707

Open
anishmehta24 wants to merge 1 commit into
aws-powertools:developfrom
anishmehta24:fix/feature-flags-weekday-locale
Open

anishmehta24 wants to merge 1 commit into
aws-powertools:developfrom
anishmehta24:fix/feature-flags-weekday-locale

Conversation

@anishmehta24

Copy link
Copy Markdown

Issue number: closes #8706

Summary

Changes

compare_days_of_week named the current day with strftime("%A").upper(), which follows the process's LC_TIME locale, so under a German locale Friday became FREITAG and never matched FRIDAY. It now looks the day up from datetime.weekday() in a tuple built from the TimeValues day names.

Added test_time_based_days_range_rule_match_with_non_english_locale, which returns a datetime whose strftime gives German day names; it fails on develop. The feature flags tests pass.

User experience

Before: a SCHEDULE_BETWEEN_DAYS_OF_WEEK rule silently stops matching if the function sets a non-English LC_TIME. After: the rule matches on the configured days regardless of locale.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@anishmehta24
anishmehta24 requested a review from a team as a code owner October 30, 2026 16:31
@anishmehta24
anishmehta24 requested a review from hjgraca October 30, 2026 16:31
@boring-cyborg

boring-cyborg Bot commented Oct 30, 2026

Copy link
Copy Markdown

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@boring-cyborg boring-cyborg Bot added the tests label Oct 30, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 30, 2026
@sonarqubecloud

Copy link
Copy Markdown

@leandrodamascena leandrodamascena left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @anishmehta24, confirmed with a real de_DE locale here: on develop a DAYS=["SATURDAY"] rule stops matching as soon as strftime says Samstag, with your change it keeps matching, and the English locale behaves exactly as before.

I'm approving now. This goes out in 3.40.0, so it will sit here for a while before I merge it. No rebase needed in the meantime, and you'll be credited in the release notes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: SCHEDULE_BETWEEN_DAYS_OF_WEEK stops matching when LC_TIME is not English

2 participants