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 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
Backported from 412d40f8448e0f83cd6bfd6c4841b25b010378d7
https://bugzilla.gnome.org/show_bug.cgi?id=736722
Index: gnome-shell-3.4.2/js/ui/calendar.js
===================================================================
--- gnome-shell-3.4.2.orig/js/ui/calendar.js 2015-03-26 21:34:47.064453237 +0100
+++ gnome-shell-3.4.2/js/ui/calendar.js 2015-03-26 21:34:23.752826288 +0100
@@ -78,23 +78,6 @@ function _formatEventTime(event, clockFo
return ret;
}
-function _getCalendarWeekForDate(date) {
- // Based on the algorithms found here:
- // http://en.wikipedia.org/wiki/Talk:ISO_week_date
- let midnightDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
- // Need to get Monday to be 1 ... Sunday to be 7
- let dayOfWeek = 1 + ((midnightDate.getDay() + 6) % 7);
- let nearestThursday = new Date(midnightDate.getFullYear(), midnightDate.getMonth(),
- midnightDate.getDate() + (4 - dayOfWeek));
-
- let jan1st = new Date(nearestThursday.getFullYear(), 0, 1);
- let diffDate = nearestThursday - jan1st;
- let dayNumber = Math.floor(Math.abs(diffDate) / MSECS_IN_DAY);
- let weekNumber = Math.floor(dayNumber / 7) + 1;
-
- return weekNumber;
-}
-
function _getDigitWidth(actor){
let context = actor.get_pango_context();
let themeNode = actor.get_theme_node();
@@ -592,7 +575,7 @@ const Calendar = new Lang.Class({
{ row: row, col: offsetCols + (7 + iter.getDay() - this._weekStart) % 7 });
if (this._useWeekdate && iter.getDay() == 4) {
- let label = new St.Label({ text: _getCalendarWeekForDate(iter).toString(),
+ let label = new St.Label({ text: iter.toLocaleFormat('%V'),
style_class: 'calendar-day-base calendar-week-number'});
this.actor.add(label,
{ row: row, col: 0, y_align: St.Align.MIDDLE });
|