My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions

Issue 44 attachment: fullcalendar-weeknumber.diff (790 bytes)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- fullcalendar.js.orig 2011-06-14 22:03:39.000000000 -0600
+++ fullcalendar.js.w 2011-06-20 19:34:09.000000000 -0600
@@ -1579,10 +1579,23 @@
return 'th';
}
return ['st', 'nd', 'rd'][date%10-1] || 'th';
- }
+ },
+ W : function(d) { return iso8601Week(d); }
};


+// Determine the week of the year based on the ISO 8601 definition.
+// copied from jquery UI Datepicker
+var iso8601Week = function(date) {
+ var checkDate = cloneDate(date);
+ // Find Thursday of this week starting on Monday
+ checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
+ var time = checkDate.getTime();
+ checkDate.setMonth(0); // Compare with Jan 1
+ checkDate.setDate(1);
+ return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
+};
+

fc.applyAll = applyAll;

Powered by Google Project Hosting