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

Let first calendar day always start on Monday #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matze
Copy link

@matze matze commented Jul 21, 2020

Shift first day of the month so that the first calendar day is always Monday. Otherwise, week days are not at a constant position month to month which is counter-intuitive to how normal calendars work.

Question is if the first day of the week should be configurable or (somehow) be fetched from the user's locale.

Shift first day of the month so that the first calendar day is always
Monday. Otherwise, week days are not at a constant position month to
month.
@@ -111,6 +111,21 @@ where
};

let draw_day = |printer: &Printer| {
let offset = match NaiveDate::from_ymd_opt(year, month, 1) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably take into account that in some countries Sunday is the first day of the week, e.g. USA, Canada, Japan. Another thing could be making this offset optional.

Also, maybe calculating day offset deserves to be in a separate function?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably take into account that in some countries Sunday is the first day of the week, e.g. USA, Canada, Japan. Another thing could be making this offset optional.

Yeah … pretty much what I wrote in the PR description.

@nerdypepper
Copy link
Owner

This PR is looking really good, thank you for showing interest in dijo!

I did have the dates offset originally, but I felt a certain disconnect with how WEEK mode interacts with this. Currently, WEEK summarizes each row of the month, because there is no offset.

With the offset in place, 1 line in WEEK mode would not correspond the 1 line in DAY mode, but rather a bit of two lines.

@matze
Copy link
Author

matze commented Jul 21, 2020

With the offset in place, 1 line in WEEK mode would not correspond the 1 line in DAY mode, but rather a bit of two lines.

That's true in a way but somehow up to now I did not see such strong connection between both modes. Hmm, one could make it configurable but that means more options which means more failure modes and complaints. No idea what to do now ;-)

@dmadisetti
Copy link

So currently week mode tabulates from whatever day of the month was the first? E.g. thursday to wednesday? That seems strange

Would it be possible to do the offset and show the previous month's contribution, maybe with a different terminal background color?

@jjn2009
Copy link
Contributor

jjn2009 commented Jul 25, 2020

might be able to resolve with a configuration file and leave it up to the user #52

@Xyzer
Copy link

Xyzer commented Apr 9, 2021

Is it possible to implement this as an option now that the configuration file has been merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants