mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Pass rc.weekstart to libshared for ISO8601 weeknum parsing if "monday" (#3654)
* libshared: bump for weekstart, epoch defines, eopww fix mainly those visible changes, and miscellaneous others see GothenburgBitFactory/taskwarrior#3623 (weekstart) see GothenburgBitFactory/taskwarrior#3651 (epoch limit defines) see GothenburgBitFactory/libshared#73 (eopww fix) * Initialize libshared's weekstart from user's rc.weekstart config This enables use of newer libshared code that can parse week numbers according to ISO8601 instead of existing code which is always using Sunday-based weeks. To get ISO behavior, set rc.weekstart=monday. Default is still Sunday / old algorithm, as before, since Sunday is in the hardcoded default rcfile. Weekstart does not yet fix week-relative shortcuts, which will still always use Monday. See #3623 for further details.
This commit is contained in:
parent
7bd3d1b892
commit
3e20ad6f6f
3 changed files with 7 additions and 7 deletions
|
@ -1105,6 +1105,11 @@ void Context::staticInitialization() {
|
||||||
Task::regex = Variant::searchUsingRegex = config.getBoolean("regex");
|
Task::regex = Variant::searchUsingRegex = config.getBoolean("regex");
|
||||||
Lexer::dateFormat = Variant::dateFormat = config.get("dateformat");
|
Lexer::dateFormat = Variant::dateFormat = config.get("dateformat");
|
||||||
|
|
||||||
|
auto weekStart = Datetime::dayOfWeek(config.get("weekstart"));
|
||||||
|
if (weekStart != 0 && weekStart != 1)
|
||||||
|
throw std::string(
|
||||||
|
"The 'weekstart' configuration variable may only contain 'Sunday' or 'Monday'.");
|
||||||
|
Datetime::weekstart = weekStart;
|
||||||
Datetime::isoEnabled = config.getBoolean("date.iso");
|
Datetime::isoEnabled = config.getBoolean("date.iso");
|
||||||
Datetime::standaloneDateEnabled = false;
|
Datetime::standaloneDateEnabled = false;
|
||||||
Datetime::standaloneTimeEnabled = false;
|
Datetime::standaloneTimeEnabled = false;
|
||||||
|
|
|
@ -404,12 +404,7 @@ int CmdCalendar::execute(std::string& output) {
|
||||||
std::string CmdCalendar::renderMonths(int firstMonth, int firstYear, const Datetime& today,
|
std::string CmdCalendar::renderMonths(int firstMonth, int firstYear, const Datetime& today,
|
||||||
std::vector<Task>& all, int monthsPerLine) {
|
std::vector<Task>& all, int monthsPerLine) {
|
||||||
auto& config = Context::getContext().config;
|
auto& config = Context::getContext().config;
|
||||||
|
auto weekStart = Datetime::weekstart;
|
||||||
// What day of the week does the user consider the first?
|
|
||||||
auto weekStart = Datetime::dayOfWeek(config.get("weekstart"));
|
|
||||||
if (weekStart != 0 && weekStart != 1)
|
|
||||||
throw std::string(
|
|
||||||
"The 'weekstart' configuration variable may only contain 'Sunday' or 'Monday'.");
|
|
||||||
|
|
||||||
// Build table for the number of months to be displayed.
|
// Build table for the number of months to be displayed.
|
||||||
Table view;
|
Table view;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 47c3262fa97c4b69542040d39be6c516c38d0e57
|
Subproject commit e0d493d16357d14f0f6092c6670777cde8eca76c
|
Loading…
Add table
Add a link
Reference in a new issue