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

Weeks view shows 53 weeks for 2014 #99

Closed
jlorenzen opened this issue Oct 16, 2013 · 6 comments
Closed

Weeks view shows 53 weeks for 2014 #99

jlorenzen opened this issue Oct 16, 2013 · 6 comments
Labels
Milestone

Comments

@jlorenzen
Copy link

The weeks view shows 53 weeks (0-52) for the year 2014.
Here is a jsfiddle reproducing the issue: http://jsfiddle.net/jameslorenzen/GU283/.

2014-extra-week

I think this is related to #61 but not sure. That issue has seemed to grow a little to support a config option to control which day of the week to start with (Sunday or Monday).

Either way, I think it would be really good if we could just fix the extra week in 2014 issue. Seems like #61 may have had a solution, but no one has tested/merged it into the baseline.

@jlorenzen
Copy link
Author

Does this project have tests that we can add to?

As pointed out in #61, the issue seems to be in Date.prototype.getWeekOfYear()

This returns 0:

new Date(1388556000000).getWeekOfYear()

Using moment.js this returns 1:

moment(1388556000000).week()

@usmonster
Copy link
Collaborator

Hey @jlorenzen, thanks for bringing this up. It does look like a duplicate of #61, even though the comments over there kind of evolved into something that really warrants a new issue.. In any case, I have mentioned in the past the need to simplify the utility functions (and get rid of the prototype overrides), so this is something I plan on doing in an upcoming pull request, unless you want to beat me to it? :]

There's lots of other gutting, refactoring, and project maintenance planned, including the addition of framework-based tests (see #87).

@jlorenzen
Copy link
Author

Well I replaced Date.prototype.getWeekOfYear() with moment(this).week() and that seemed to solve the week 0 issue for 2014, but for some reason my JAN-1-2014 item still shows starting week 2.

2014-extra-week-momentjs-change

Another interesting observation. With the above changes, the year 2014 includes the first week of 2015. Same thing for the end of 2015. However, the end of 2013 ends with week 52. I would think 2014 would end with week 52 and 2015 would start with week 1 and not week 2. Then if I had an item that was 12-31-2014, that would stretch into week 1 of 2015. Not sure what exactly happens though if it overlaps with an item that is 1-1-2015 in the weeks view (I'm actually going to test this next to see what happens).

This weeks view is pretty complicated. :]

@usmonster
Copy link
Collaborator

Yep. :] It's a confluence of bugs--see #73

@jlorenzen
Copy link
Author

This issue seems to be the same issue in mbielanczuk jQuery.Gantt project: mbielanczuk#32 (week with id "0")

@usmonster
Copy link
Collaborator

Yes, it is at least related, as mentioned in #73.

diogenesl added a commit to diogenesl/jQuery.Gantt that referenced this issue Sep 15, 2014
Fixes bugs:
Weekly scale showing week zero in some situations (taitems#112)
Weekly scale not showing correct number of weeks (52 or 53) (taitems#99)
Daily scale showing day 1 inside the previous month group

PS: This is my first GitHub contribuition, hope that I'm doing everything right.
@usmonster usmonster added this to the v1.3.0 milestone Dec 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants