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

Week number is changed when starting day is modified #66

Open
Granddave opened this issue Sep 23, 2023 · 5 comments
Open

Week number is changed when starting day is modified #66

Granddave opened this issue Sep 23, 2023 · 5 comments

Comments

@Granddave
Copy link

Granddave commented Sep 23, 2023

Hi, I noticed that the week numbers are off by one when --starting-day 1 is provided.

Today's the 2023-09-23, week 38 with Monday as start of the week, but when --starting-day 1 is provided the week 39 is shown. Locale is en_US.

I'm running v1.1.0 via cargo install.

Below are snippets of the current month.

rusti-cal -w --starting-day 0

        September
   Su Mo Tu We Th Fr Sa
35                 1  2
36  3  4  5  6  7  8  9
37 10 11 12 13 14 15 16
38 17 18 19 20 21 22 23
39 24 25 26 27 28 29 30

rusti-cal -w --starting-day 1

        September
   Mo Tu We Th Fr Sa Su
36              1  2  3
37  4  5  6  7  8  9 10
38 11 12 13 14 15 16 17
39 18 19 20 21 22 23 24
40 25 26 27 28 29 30
@arthurhenrique
Copy link
Owner

arthurhenrique commented Sep 25, 2023

hey @Granddave I really don't know if this is an expected behaviour. Could you help me understand?

We assume that each line have a diferent week day, like a counter that increments for each break line. Let deep in dive the january month:

  • weeks starts with sunday
rusti-cal -w --starting-day 0
       January               
   Su Mo Tu We Th Fr Sa  
 1  1  2  3  4  5  6  7
 2  8  9 10 11 12 13 14
 3 15 16 17 18 19 20 21
 4 22 23 24 25 26 27 28
 5 29 30 31            

  • weeks starts with monday
rusti-cal -w --starting-day 1
          January       
    Mo Tu We Th Fr Sa Su
  1                    1
  2  2  3  4  5  6  7  8
  3  9 10 11 12 13 14 15
  4 16 17 18 19 20 21 22
  5 23 24 25 26 27 28 29
  6 30 31

We change the week number as the line breaks. But in this case when we start with Monday at january, how should I show the week number? Could you provide example please?

@arthurhenrique
Copy link
Owner

arthurhenrique commented Sep 25, 2023

Now I got the bug, according to this ISO https://en.wikipedia.org/wiki/ISO_8601 (week starts only with monday) we should present january 2023 like this:

          January       
    Mo Tu We Th Fr Sa Su
 52                    1
  1  2  3  4  5  6  7  8
  3  9 10 11 12 13 14 15
  4 16 17 18 19 20 21 22
  5 23 24 25 26 27 28 29
  6 30 31

I don't know when I'll be able to solve this, but it would be fun, thanks

@Granddave
Copy link
Author

Hi! Yes, that's correct, Sunday 1th is week 52 of last year.
Sorry for being unclear about the bug and expected results.

but it would be fun

Hehe that's good 😄

@elliotwutingfeng
Copy link
Contributor

@arthurhenrique Did you mean this instead?

          January       
    Mo Tu We Th Fr Sa Su
 52                    1
  1  2  3  4  5  6  7  8
  2  9 10 11 12 13 14 15
  3 16 17 18 19 20 21 22
  4 23 24 25 26 27 28 29
  5 30 31

@elliotwutingfeng
Copy link
Contributor

elliotwutingfeng commented Dec 21, 2023

          January              
    Tu We Th Fr Sa Su Mo    
  1                 1  2   
  2  3  4  5  6  7  8  9
  3 10 11 12 13 14 15 16  
  4 17 18 19 20 21 22 23   
  5 24 25 26 27 28 29 30  
  6 31                                                                     

How should we handle this? Given that the first week has Sunday (from week 52 of 2022), and Monday (from week 1 of 2023).

the week with 4 January in it,

from the wiki page seems to be the most straightforward definition.

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

No branches or pull requests

3 participants