clock: add weeks-numbering option for configurable CW calculation

The iso8601 flag previously controlled both the calendar grid layout
and the week number format as a coupled boolean. This adds a new
weeks-numbering option (iso/monday/sunday) that explicitly overrides
just the week number calculation method, independent of iso8601 and
locale settings. Existing behaviour is fully preserved when the option
is not set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Thomas Beyer
2026-03-20 11:43:17 +01:00
co-authored by Claude Sonnet 4.6
parent ab7bfdb297
commit 86d516c74d
3 changed files with 42 additions and 9 deletions
+3 -1
View File
@@ -12,6 +12,7 @@ const std::string kOrdPlaceholder{"ordinal_date"};
enum class CldMode { MONTH, YEAR };
enum class WS { LEFT, RIGHT, HIDDEN };
enum class WeekNumbering { LOCALE, ISO, MONDAY, SUNDAY };
class Clock final : public ALabel {
public:
@@ -50,7 +51,8 @@ class Clock final : public ALabel {
std::string cldMonCached_; // calendar Month mode. Cached calendar
date::day cldBaseDay_{0}; // calendar Cached day. Is used when today is changing(midnight)
std::string cldText_{""}; // calendar text to print
bool iso8601Calendar_{false}; // whether the calendar is in ISO8601
bool iso8601Calendar_{false}; // whether the calendar is in ISO8601
WeekNumbering weekNumbering_{WeekNumbering::LOCALE}; // week number calculation method
CldMode cldMode_{CldMode::MONTH};
auto get_calendar(const date::year_month_day& today, const date::year_month_day& ymd,
const date::time_zone* tz) -> const std::string;