Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
gnome-shell.1083
gnome-shell-calendar-fix-week-number.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gnome-shell-calendar-fix-week-number.patch of Package gnome-shell.1083
From 1e8e5d4671f017926098fdf6bd79310372607713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org> Date: Thu, 13 Nov 2014 15:14:56 +0000 Subject: [PATCH] calendar: Stop computing week number ourselves Correctly computing the ISO week number is tricky and we already have code in the platform to do it, so just refer its computation to GDateTime rather than doing it ourselves. https://bugzilla.gnome.org/show_bug.cgi?id=736722 --- js/ui/calendar.js | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) Index: gnome-shell-3.10.4/js/ui/calendar.js =================================================================== --- gnome-shell-3.10.4.orig/js/ui/calendar.js +++ gnome-shell-3.10.4/js/ui/calendar.js @@ -81,23 +81,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 _getCalendarDayAbbreviation(dayNumber) { let abbreviations = [ /* Translators: Calendar grid abbreviation for Sunday. @@ -655,7 +638,7 @@ const Calendar = new Lang.Class({ } 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 });
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor