Bug: SCHEDULE_BETWEEN_DAYS_OF_WEEK stops matching when LC_TIME is not English

オープン
#8,706 コメント 3 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@anishmehta24 がすでに取り組んでいます。

2026年10月30日 から。

  • #8707 @anishmehta24 による — オープン

評価

この issue はまだ評価されていません。

説明

bug feature_flags

Expected Behaviour

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

import locale
from aws_lambda_powertools.utilities.feature_flags.comparators import compare_days_of_week

cond = {"DAYS": ["FRIDAY"], "TIMEZONE": "UTC"}  # run on a Friday
compare_days_of_week(None, cond)  # True

locale.setlocale(locale.LC_TIME, "de_DE.UTF-8")
compare_days_of_week(None, cond)  # False, the current day is "FREITAG"

Steps to Reproduce

  1. Configure a feature flag rule with SCHEDULE_BETWEEN_DAYS_OF_WEEK and today's day in DAYS.
  2. Set a non-English LC_TIME in the function.
  3. 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.

Powertools for AWS Lambda (Python) version

latest (develop, 3.38.0)

AWS Lambda function runtime

3.12

Packaging format used

PyPi

Debugging logs

No response

主要言語
Python
スター
3.3k
フォーク
511
平均マージ
3日 4時間
マージ済み PR(30日)
98

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

aws-powertools/powertools-lambda-python のほかの issue

aws-powertools/powertools-lambda-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。