Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 547507

Summary: [DateTime] Locale-dependent first day of week is calculated incorrectly
Product: [RT] RAP Reporter: Ago Kuusik <akuusik>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: mknauer
Version: 3.6   
Target Milestone: 3.13   
Hardware: PC   
OS: Windows 10   
Whiteboard:

Description Ago Kuusik CLA 2019-05-21 06:57:37 EDT
If the language of a browser is set to Estonian, the calendar drop-down of the DateTime widget shows the weeks starting from Saturday.

A wrong week start day appears with many other languages (Afrikaans, Catalan,  etc.) It does not seem to depend on the browser brand or version.

A deeper investigation revealed that the Javascript code in org.eclipse.rap.rwt bundle has a contradiction. There is a hard-coded mapping (weekStart) from _country_ ISO codes to week start day numbers in rwt/widgets/base/Calendar.js for the countries where the week does not start on Monday. The mapping is queried by taking the key from getTerritory() method, or, if this method returns no value, getLanguage() method of rwt/client/Client.js. getTerritory() method always returns an empty string in the current implementation, because _browserLocale field is calculated _initLocale() as the language code without any country suffix. Therefore the country mapping is always queried with _language_ ISO code, and in many cases, the language code is matches a completely irrelevant country code: (Estonian-ET-Ethiopia, Afrikaans-AF-Afghanistan, etc.)

Either the exceptional week start day mapping should be made on language code basis, or at least, the language code must not be used for weekStart map query.
Comment 1 Ivan Furnadjiev CLA 2019-06-26 05:56:53 EDT
Could you provide a Gerrit change without your suggestion?