Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass rc.weekstart to libshared for ISO8601 weeknum parsing if "monday" #3654

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,11 @@ void Context::staticInitialization() {
Task::regex = Variant::searchUsingRegex = config.getBoolean("regex");
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::standaloneDateEnabled = false;
Datetime::standaloneTimeEnabled = false;
Expand Down
7 changes: 1 addition & 6 deletions src/commands/CmdCalendar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,7 @@ int CmdCalendar::execute(std::string& output) {
std::string CmdCalendar::renderMonths(int firstMonth, int firstYear, const Datetime& today,
std::vector<Task>& all, int monthsPerLine) {
auto& config = Context::getContext().config;

// 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'.");
auto weekStart = Datetime::weekstart;

// Build table for the number of months to be displayed.
Table view;
Expand Down
2 changes: 1 addition & 1 deletion src/libshared
Submodule libshared updated 115 files
Loading