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

Wrong week number. Today (3 January 2017) it emits week 0. #3

Open
unagitated opened this issue Jan 3, 2017 · 7 comments
Open

Wrong week number. Today (3 January 2017) it emits week 0. #3

unagitated opened this issue Jan 3, 2017 · 7 comments

Comments

@unagitated
Copy link

Wrong week number. Today (3 January 2017) it emits week 0.

@sindrenm
Copy link

Yeah, and this week is week 11, not 10 … 😐

@YounGoat
Copy link

The starting day of week 1 is sometimes confusing. According to MySQL function WEEK(), there are 7 different modes to define the start day of week 1 and the number of week before week 1.
See package dafo.getWeekOfYear() for a smiliar implementation in Node.js .

@sindrenm
Copy link

sindrenm commented Jan 22, 2018

ISO 8601 defines the first week as the week with the first Thursday in it. The first Thursday in 2018 would be January 4. That makes the current week (the one with January 25 in it) the 4th week of the year.

This package reports today as being in week 3. If the package does not intend to follow ISO 8601 to determine which week it is, then I suggest that at least be documented in the README to avoid further confusion.

@YounGoat
Copy link

YounGoat commented Jan 22, 2018

@sindrenm You are right!
According to ISO 8601, the first day of week is Monday, and week 1 is the first week has 4 or more days in this year (this description is equivalent to the week with the first Thursday in it), so mode 3 used in MySQL WEEK() is the right choice( see Week Mode for details):

const dafo = require("dafo");
dafo.getWeekOfYear(new Date(2018, 0, 25), /* mode */ 3);
// RETURN 4

And with mode 0 or 2, it returns 3.

@sindrenm
Copy link

Yep, dafo seems to do the trick when passed mode 3, but this package (week) still doesn't. However, I'm not sure if it's maintained. @jonschlinkert? 😄

@jonschlinkert
Copy link
Member

However, I'm not sure if it's maintained. @jonschlinkert?

This is a Free and Open Source software project, maintained by myself and other devs in their free time. Don't make comments that are explicitly intended to make someone feel guilty and obligated to respond to you in an expedient way.

I usually block people for making divisive or manipulative comments, but since this project does not have a contributing guide I'll give you a warning.

@sindrenm
Copy link

Sorry, @jonschlinkert, it was not meant in such a way at all. It was meant as a friendly question, but I understand how it might have come out as a bit snarky. I am grateful for the project and contribution to OSS. After all, I was using your package, so I should be. 😄

So I don't want you to feel guilty, if anything I want you to be proud of the fact that you made this package available for everyone to use. 👍

Now that that's in the clear, I think it would be good to have contributing guidelines in general, but it's not a necessity. And if pull requests are welcome, then that's fantastic. 😄

Are we good?

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

No branches or pull requests

4 participants