diff --git a/calendar/resources/content/datepicker/calendar.css b/calendar/resources/content/datepicker/calendar.css index 521af79cff1..caacacf0f8c 100644 --- a/calendar/resources/content/datepicker/calendar.css +++ b/calendar/resources/content/datepicker/calendar.css @@ -76,6 +76,7 @@ calendar { .cal-header { font-family: Arial; color: blue; + text-align: center; } .cal-row-body { @@ -85,6 +86,7 @@ calendar { font-family: Arial; color: #000000; border: 1px solid transparent; + text-align: center; -moz-binding: url("calendar.xml#cal-day"); } diff --git a/calendar/resources/content/datepicker/calendar.xml b/calendar/resources/content/datepicker/calendar.xml index 95bd0997efc..ee6ce84e32c 100644 --- a/calendar/resources/content/datepicker/calendar.xml +++ b/calendar/resources/content/datepicker/calendar.xml @@ -20,13 +20,13 @@ - - - - - - - + + + + + + + @@ -102,6 +102,19 @@ if (!this.mInitialized) { this.mInitialized = true; + // Find out which should be the first day of the week + var pref = Components.classes[ + "@mozilla.org/preferences-service;1" + ].getService(Components.interfaces.nsIPrefBranch); + + this.weekStart; + try { + this.weekStart = pref.getIntPref("calendar.week.start"); + } + catch (e) { + this.weekStart = 0; + } + // save references for convenience var monthbox = document.getAnonymousNodes(this)[0].childNodes[0]; this.mLeftBtn = monthbox.childNodes[0]; @@ -119,10 +132,49 @@ var monthchange = this.getAttribute("onmonthchange"); if (monthchange) this.onmonthchange = new Function(monthchange); + this.setHeader(); this.showMonth(this.mValue); } ]]> + + + see bug 63370 for details + + var localeService = Components.classes[ + "@mozilla.org/intl/nslocaleservice;1" + ].getService(Components.interfaces.nsILocaleService); + + var stringBundleService = Components.classes[ + "@mozilla.org/intl/stringbundle;1" + ].getService(Components.interfaces.nsIStringBundleService); + + var bundleURL = "chrome://calendar/locale/dateFormat.properties"; + var dateBundle = stringBundleService.createBundle( + bundleURL, localeService.GetApplicationLocale() + ); + + // Reset the headers + var header = document.getAnonymousNodes(this)[0]. + childNodes[1].childNodes[0] + ; + + for (var column = 0; column < header.childNodes.length; column++) { + + header.childNodes[column].setAttribute( "value", + dateBundle.GetStringFromName( + "day."+ + ((this.weekStart + column) % 7 + 1) + + ".short" + ) + ); + } + + ]]> + + @@ -147,11 +199,11 @@ //-------- Update the calendar var calbox = document.getAnonymousNodes(this)[0].childNodes[1]; - + var daytime = 86400000; // milliseconds in a day - var firstWeekday = aDate.getDay(); + var firstWeekday = (7 + aDate.getDay() - this.weekStart) % 7; var date = new Date((aDate.getTime() - (firstWeekday*daytime))); - + for (var k = 1; k < calbox.childNodes.length; k++) { var row = calbox.childNodes[k]; diff --git a/calendar/resources/locale/en-US/dateFormat.properties b/calendar/resources/locale/en-US/dateFormat.properties index a407a688130..14273d4dfd4 100644 --- a/calendar/resources/locale/en-US/dateFormat.properties +++ b/calendar/resources/locale/en-US/dateFormat.properties @@ -79,5 +79,14 @@ day.5.Mmm=Thu day.6.Mmm=Fri day.7.Mmm=Sat +# Can someone tell me why were not counting from zero? +day.1.short=S +day.2.short=M +day.3.short=T +day.4.short=W +day.5.short=T +day.6.short=F +day.7.short=S + am-string=AM pm-string=PM