| Issue 295: | Week numbers on side of calendar | |
| 40 people starred this issue and may be notified of changes. | Back to list |
Display week numbers (optionally) on the left side of the month/week view.
Jan 20, 2010
#1
zenve...@gmail.com
Feb 5, 2010
thanks for the suggestion. will hold off on building anything until i know more people want it though
Labels:
-Type-Defect Type-Enhancement
Feb 6, 2010
i got another issue/email, i forget who, but proposing a W variable for formatDate, so you could include the week # in any title or day. this isn't the same as a new column though, but in a similar vein
Feb 10, 2010
Check my remarks and source-code on: https://code.google.com/p/fullcalendar/issues/detail?id=44 ( issue 44 )
Feb 26, 2010
(No comment was entered for this change.)
Summary:
Week numbers on side of calendar
Mar 1, 2010
we would like to have this kind of functionlity also
Mar 1, 2010
download the source in the 44 issue
Mar 1, 2010
It's not the same thing. :)
Mar 23, 2010
We would like this too.
Apr 19, 2010
I'd love it too
Apr 19, 2010
definetly important!
May 10, 2010
Hi there, we would really like this functionality too. Any idea when it will be implemented?
May 31, 2010
I would also like to see this enhancement. In Denmark (and probably elsewhere) week numbers are frequently used to reference dates that are spanning one or more weeks.
Jun 2, 2010
I would also like to see this functionality. In the Netherlands, we use weeknumbers all the time and I kind of need it for a project I'm working on. I tried to add it myself, but I got issues with the loading of events. The proper column couldn't be found, so I gave up for now. Maybe I'll try again in my spare time.
Jun 4, 2010
Hey, a week number column would be definitely great. would love to see this functionality. Week numbers on side of calendar +1
Jul 1, 2010
Would love to see the week numbers link to load the week view, and then in week view have day numbers at the top link to the day view
Jul 5, 2010
Issue 531 has been merged into this issue.
Jul 6, 2010
What would also be great is if we could control the week numbers as well as some companies like to have week numbers starting at the beginning of the financial year, others have their own week numbering system etc.
Jul 6, 2010
Hi all, When I try to change 'start' => "$year-$month-10" to 'start' => "$year-$month-9" or 'start' => "$year-$month-7" in json_events.php example, I didn't have expected results, specify is events didn't display in those days. Thank all for attending.
Jul 19, 2010
Week number is definitely what is missing (not 'W' flag, but a real column). Pay attention: there are different approaches of caclulating WK number. Best would be to consider couple ways, but the ISO one should be as a default - I suggest. http://en.wikipedia.org/wiki/ISO_week_date
Oct 7, 2010
(No comment was entered for this change.)
Status:
Maybe
Oct 30, 2010
I would like to add an extra column on the right side where I can show week numbers and other summary/totals information for each week.
Jan 6, 2011
Week numbers on the side of the calendar please... +1
Jan 19, 2011
I'd love to have the Work Week numbers as well. Without those the calendar won't work for us. I modified the fullcalendar.js to make it do what I want, but would prefer it was part of the built in functionality so updates to fullcalendar.js would be easy to implement for me. Not the most elegant code, but it is my first pass and does what I need. Alternatively, if I could add it somewhere else in my code without modifying fullcalendar.js that would be great. Any hints on getting the dates for a cell or adding to it after the initial call to the calendar code? The basics of what I did is below in these three snippets. There are two different week calculations thanks to this site: http://javascript.about.com/library/blstdweek.htm //Get Workweek Date.prototype.getWeek = function () { var onejan = new Date(this.getFullYear(), 0, 1); return Math.ceil((((this - onejan) / 86400000) + onejan.getDay() + 1) / 7); } //Get ISO Workweek Date.prototype.getMDay = function () { return (this.getDay() + 6) % 7; } Date.prototype.getISOYear = function () { var thu = new Date(this.getFullYear(), this.getMonth(), this.getDate() + 3 - this.getMDay()); return thu.getFullYear(); } Date.prototype.getISOWeek = function () { var onejan = new Date(this.getISOYear(), 0, 1); var wk = Math.ceil((((this - onejan) / 86400000) + onejan.getMDay() + 1) / 7); if (onejan.getMDay() > 3) wk--; return wk; } //set a span with the Workweek info when on the first day of the week. Then add that in down below when the cell is populated. var workweek; for (i = 0; i < rowCnt; i++) { s += "<tr class='fc-week" + i + "'>"; for (j = 0; j < colCnt; j++) { if (j == 0) { workweek = "<span class='rk-workweek' style='float:left;'>WW" + d.getWeek() + "</span>"; } else { workweek = ""; } s += "<td class='fc-" + dayIDs[d.getDay()] + ' ' + // needs to be first tm + '-state-default fc-day' + (i * colCnt + j) + (j == dit ? ' fc-leftmost' : '') + (rowCnt > 1 && d.getMonth() != month ? ' fc-other-month' : '') + (+d == +today ? ' fc-today ' + tm + '-state-highlight' : ' fc-not-today') + "'>" + (showNumbers ? workweek + "<div class='fc-day-number'>" + d.getDate() + "</div>" : '') + Then down a bit further I added this: td.find('div.fc-day-number').text(d.getDate()); //Add the workweek td.find('span.rk-workweek').text("WW" + d.getWeek());
Jan 21, 2011
@rusty: works perfectly for me!!
Only small changes for me were these lines, b/c my calendar starts with sunday:
if (j == 0) { workweek = "<span class='rk-workweek' style='float:left;'>week" + d.getISOWeek() + "<</span>"; }
else if (j == 1) { workweek = "<span class='rk-workweek' style='float:left;'>>week" + d.getISOWeek() + "</span>"; }
else { workweek = ""; }
Thanks!!
Mar 24, 2011
Issue 844 has been merged into this issue.
Sep 20, 2011
It's very common in European countries (more than in the states I think) to talk and plan using week numbers, so this would definitely be a useful feature, +1.
Sep 21, 2011
+1 for week numbers. Really need it Thanks for all your great work
Sep 23, 2011
+1 for week numbers. Really need a side-column for it. Thanks in advance!
Oct 3, 2011
Does anyone have a patch for this? Can't get the code above to work.
Oct 13, 2011
+1 for week numbers. Other than that, it's a great script.
Dec 17, 2011
Code in 1.5x changed completely. For 1.5x I pasted around line 2219: var workweek; //added for https://code.google.com/p/fullcalendar/issues/detail?id=295 //Get Workweek Date.prototype.getWeek = function () { var onejan = new Date(this.getFullYear(), 0, 1); return Math.ceil((((this - onejan) / 86400000) + onejan.getDay() + 1) / 7); } //Get ISO Workweek Date.prototype.getMDay = function () { return (this.getDay() + 6) % 7; } Date.prototype.getISOYear = function () { var thu = new Date(this.getFullYear(), this.getMonth(), this.getDate() + 3 - this.getMDay()); return thu.getFullYear(); } Date.prototype.getISOWeek = function (i) { var onejan = new Date(this.getISOYear(), 0, 1); var wk = Math.ceil((((this - onejan) / 86400000) + onejan.getMDay() + 1) / 7); if (onejan.getMDay() > 3) wk--; wk+= i+1; return wk; } d = cloneDate(t.visStart); Then a couple of lines later change to: for (i=0; i<maxRowCnt; i++) { s += "<tr class='fc-week" + i + "'>"; for (j=0; j<colCnt; j++) { if (j == 1) { workweek = "<span class='rk-workweek' style='float:left;'>week" + d.getISOWeek(i) + "</span>"; } else { workweek = ""; } s += "<td class='fc- " + contentClass + " fc-day" + (i*colCnt+j) + "'>" + // need fc- for setDayID "<div>" + (showNumbers ? workweek + "<div class='fc-day-number'/>" : '' ) + "<div class='fc-day-content'>" + "<div style='position:relative'> </div>" + "</div>" + "</div>" + "</td>"; } s += "</tr>"; }
Feb 8, 2012
Please implement this functionality or include one of the patches in the next release!
Mar 18, 2012
What is the hold-up here? It appears that there is more or less a ready-made patch. How about incorporating in the Fullcalendar, so it can benefit everyone? Week numbers are essential (at least in Europe).
Mar 19, 2012
+1. This would be a very much needed feature.
Apr 12, 2012
The modification mentioned in comment 33 worked for me in v1.5.3. However, it would be good idea to implement this into the next version of fullcalendar.
Apr 13, 2012
Correction, modification mentioned in comment 33 only works on the first load. When you update the calendar (by clicking an arrow-button for example) the week number aren't updated.
Jul 18, 2012
Your calendar was perfect for my needs until I realised it didn't support week numbers. I'd really like a week numbers column on the left hand side of the calendar and the ability to add "events" to it.
Aug 20, 2012
is there any way to implement the week numbers into the Solgema.Fullcalendar ?
Aug 27, 2012
I've gotten this working including when you click the arrow button (v1.5.3):
Add showWeekNumbers: false as part of the defaults.
Go to around line 2241 and close off the string concatentation. Then add this code:
if(j == 0 && calendar.options.showWeekNumbers) {
s += "<div class='fc-week-number' />";
}
Then go to around line 2308 and in bodyCells.each add this code:
if(i % 7 == 0 && calendar.options.showWeekNumbers) {
cell.find('div.fc-week-number').text(date.getWeek());
}
Then you just need to add this code to calculate the week:
Date.prototype.getWeek = function() {
var onejan = new Date(this.getFullYear(),0,1);
var week = Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7);
return week;
}
If you then add the option showWeekNumbers: true this will work.
Nov 3, 2012
I want to make an addition to daveyjo.
Working weeknumbers, 100%:
Go to around line 2241 and close off the string concatentation. Then add this code:
if(j == 0 && calendar.options.showWeekNumbers) {
s += "<div class='fc-week-number' />";
}
Then go to around line 2308 and in bodyCells.each add this code:
var weekDivider = 5;
if (opt('weekends') == 1) weekDivider = 7;
if(i % weekDivider == 0 && calendar.options.showWeekNumbers) {
cell.find('div.fc-week-number').text(date.getWeek());
}
Then you just need to add this code to calculate the week:
Date.prototype.getWeek = function() {
var onejan = new Date(this.getFullYear(),0,1);
var week = Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7);
return week;
}
If you then add the option showWeekNumbers: true this will work.
On line 32 add:
showWeekNumbers: true,
Thanks to daveyjo.
Good luck!
Dec 6, 2012
Probably just me being a tool, but I can't seem to get it to work in 1.5.3
Dec 28, 2012
We definitely need week numbers. It's used extensively in Europe. Thank you all for the efforts above that try to make custom implementations, but it really should be an integrated part of Fullcalendar. Without week numbers we can't use Fullcalendar. Good luck, fingers crossed!
Jan 29, 2013
I got error on add this code
if(j == 0 && calendar.options.showWeekNumbers) {
s += "<div class='fc-week-number' />";
}
Uncaught SyntaxError: Unexpected token ==
Mar 2, 2013
Issue 44 has been merged into this issue.
Mar 2, 2013
Issue 1352 has been merged into this issue.
Mar 2, 2013
Issue 1489 has been merged into this issue.
Mar 2, 2013
Issue 1657 has been merged into this issue.
Mar 2, 2013
Hello all. I have implemented this feature, to be in included in v1.5.5 (not yet released). Can you please test it out and see if it suites your needs? Any feedback is appreciated. Options (better docs to come): - weekNumbers: false (default) / true - weekNumberTitle: 'W' - weekNumberCalculation: 'iso' (default), function The default method of calculating the week # is the iso8601 method. Ideally FullCalendar would have better i18n support, but for now, the only way to make a localized week # is to pass in a function for weekNumberCalculation, that receives a date object, and returns a week #. Source Code (not yet production): https://github.com/arshaw/fullcalendar/tree/v1.5.5 (see ./tests/week_numbers.html) Download (not yet production): https://github.com/arshaw/fullcalendar-component/tree/v1.5.5 Thanks!
Status:
Accepted
Jun 18, 2013
Hey, a week number column would be definitely great. would love to see this functionality. Week numbers on side of calendar +10000
Jun 18, 2013
@adamrs i have gone through the links you provided but is is just showing 404 page not found alert..can you please help me to include week number option
Jun 18, 2013
Any one can say me that whether that week number issue is solved or not?
Jun 18, 2013
Yes, this has been implemented in a recent version of fullcalendar. This issue should be closed.
Jun 18, 2013
but i am still have the problem with the week number.Can you please say me from where can i download the new version and also i need to put a coma before year in week view
Jun 18, 2013
Any one can help me i have replaced with the latest version of fullcalendar.js..But still the week number is not showing.
Jun 18, 2013
The setting for this is documented here http://arshaw.com/fullcalendar/docs/display/weekNumbers/ but also see http://arshaw.com/fullcalendar/docs/display/weekNumberCalculation/ and http://arshaw.com/fullcalendar/docs/text/weekNumberTitle/
Aug 13, 2013
(No comment was entered for this change.)
Status:
Released
Labels: -Type-Enhancement Type-Feature
Nov 28, 2013
Can someone provide the function or add calculation option for the case of week 01 considered as the first week where at least 4 days are in the new year. Today is W48 by this criteria. The calendar is saying 47.
Nov 28, 2013
German paper calendar all use the criteria of week 01 mentioned above, not ISO8601 criteria.
Jan 23, 2014
Weeknr for 2014 is now one week off. last year ended with week 1. but fullcalendar counts to 52 then restarts. so now its week 4, but FC is showing as week 3.
Feb 12, 2014
There are, from what I understand, only three ways to calculate week numbers. You set you reference from week number 1, which is defined in one of three ways: - The first week contains January 1 - The first week where four days fall in January - The first week where all seven days fall in January And as usual, the US and Europe differs on how week number 1 is set. But, that it necessarily not a problem, since week numbers are hardly used in the US. A great calendar supports week numbering for the above three cases, including properties for which day the week starts (usually Sunday or Monday) and also turning week numbers on and off. Good luck, I'm cheering on and following closely.
Mar 21, 2014
i haven't been following this convo very closely, but v2.0 will offer localized week-number calculation because it leverages MomentJS. |
|
| ► Sign in to add a comment |