adding support for expressions of the for {x+/-y} to allow for offsets #1189
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I use ElevenClock in my organization to display the current work week (%W) using the custom formatting options (it's very useful thanks!). Unfortunately my organization uses a different definition of work week so some years there is an off by one error. It looks like ElevenClock uses the strftime C function which defines week 1 as starting on the first Monday. There is an ISO standard (ISO 8601) that defines things differently (Week 1 is the first week with a majority of its days in Jan), and my org uses a third definition.
My recommendation is to allow offsets/expressions in the custom data formatting to solve this problem more generally. e.g
%a {%W+1}.%w to add 1 week
I imagine it could be useful for other offsets I'm not thinking of.
I'm open to other solutions, but I have already implemented a fix for myself using a simple evaluation function that supports basic addition and subtraction inside {}'s as above that wraps the calls to strftime.
If there is interest I would be happy to create a pull request so others could benefit. It's a relatively small change, but I personally know a bunch of folks that would find it very useful.