Skip to content

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

Merged
leandrodamascena merged 2 commits into
aws-powertools:developfrom
anishmehta24:fix/feature-flags-weekday-locale
Nov 4, 2026
Merged

leandrodamascena merged 2 commits into
aws-powertools:developfrom
anishmehta24:fix/feature-flags-weekday-locale

Conversation

@anishmehta24

Copy link
Copy Markdown
Contributor

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

@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.

@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.01%. Comparing base (d7b3024) to head (1d97209).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #8707   +/-   ##
========================================
  Coverage    97.01%   97.01%           
========================================
  Files          321      321           
  Lines        16431    16432    +1     
  Branches      1484     1484           
========================================
+ Hits         15940    15941    +1     
  Misses         350      350           
  Partials       141      141           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leandrodamascena
leandrodamascena merged commit 9945fcb into aws-powertools:develop Nov 4, 2026
@boring-cyborg

boring-cyborg Bot commented Nov 4, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

@powertools-for-aws-oss-automation

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

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