United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4518811 : Wrong WEEK_OF_YEAR in Locale de

Details
Type:
Bug
Submit Date:
2001-10-24
Status:
Closed
Updated Date:
2004-03-09
Project Name:
JDK
Resolved Date:
2002-11-17
Component:
globalization
OS:
solaris_2.6,windows_2000
Sub-Component:
translation
CPU:
x86,sparc
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.3.1,5.0
Fixed Versions:
1.4.2 (mantis)

Related Reports
Backport:
Duplicate:
Relates:
Relates:

Sub Tasks

Description

Name: yyT116575			Date: 10/24/2001


java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

Following main class computes first week in year 1999 in "de" wrong, when we
setMinimalDaysInFirstWeek(4), the result is OK, but disagrees to bug
description 4302061, where week 52 is documented as last week of 1998.


import java.util.Calendar;
import java.util.*;

public class Test {
  public static void main(String [] args) {
    System.err.println("Version = "+System.getProperty("java.version")+
        ", CLASSPATH = "+System.getProperty("java.class.path"));
    System.err.println("Locale is: "+Locale.getDefault());
    Calendar c = Calendar.getInstance();
    c.set(Calendar.YEAR, 1999);
    //c.set(Calendar.DAY_OF_MONTH, 1);
    c.set(Calendar.DATE, 0);
    c.set(Calendar.MONTH, 0);  // month is 0-n
    c.set(Calendar.HOUR, 0);
    c.set(Calendar.MINUTE, 0);
    c.set(Calendar.SECOND, 0);
    System.err.println("Minimal Days in First Week: "+c.getMinimalDaysInFirstWeek());
    System.err.println("WEEK_OF_YEAR is: "+c.get(Calendar.WEEK_OF_YEAR));
    System.err.println("Now setting locale minimal day in first week explicitely ...");
    c.setMinimalDaysInFirstWeek(4);  // as it is in "de"
    c.setTime(c.getTime());  // refresh
    System.err.println("Minimal Days in First Week: "+c.getMinimalDaysInFirstWeek());
    System.err.println("WEEK_OF_YEAR is: "+c.get(Calendar.WEEK_OF_YEAR));
  }
}


... brings following output:

Version = 1.3.1, CLASSPATH = .;C:\software\jdk1.3
\jre\lib\rt.jar;C:\software\jdk1.3\jre\lib\i18n.jar
Locale is: de_AT
Minimal Days in First Week: 1
WEEK_OF_YEAR is: 1
Now setting locale minimal day in first week explicitely ...
Minimal Days in First Week: 4
WEEK_OF_YEAR is: 53


C:\> dir C:\software\kdk1.3\jre\lib

 Directory of C:\software\jdk1.3\jre\lib

06.05.2001  04:19            2.765.521 i18n.jar
06.05.2001  04:19           13.584.926 rt.jar
(Review ID: 134366) 
======================================================================

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mantis
tiger-beta
tiger-beta2

FIXED IN:
mantis
tiger-beta
tiger-beta2

INTEGRATED IN:
mantis
tiger-b42
tiger-beta2

VERIFIED IN:
mantis-rc


                                     
2004-06-14
EVALUATION

Minimal Days in First Week is defined in de_AT locale as follows.

            { "DateTimeElements",
                new String[] {
                    "2", // first day of week
                    "1" // min days in first week
                }
            }

In de locale, it's defined as follows.

            { "DateTimeElements",
                new String[] {
                    "2", // first day of week
                    "4" // min days in first week
                }
            }

So I'd like L10N to evaluate this.
###@###.### 2001-12-10


Kieran, could you please evaluate this bug? thx!
###@###.### 2002-11-05


###@###.### 2002-11-07

As far as I can see from my source, 4 is the right value for min days in first week, according to ISO 8601. Looking at http://home.t-online.de/home/PeterJHaas/DateTime/wnden.htm, that's correct for German (and our value for Austria is wrong!) 

Also, in bug 4302061, the evaluation says "In a European locale, such as "de", it returns 52 (not 53) because MinimalDaysInFirstWeek is 4 (ISO 8601)." Masayoshi-san is speaking about years in general, not 1998 in particular. This sounds sort of stange, but from one of my sources I've found out that:
"Most years have 52 weeks, but years that start on a Thursday and leap years that start on a Wednesday have 53 weeks. " (http://www.tondering.dk/claus/cal/node6.html#SECTION00660000000000000000). You learn something new every day, right?

If you run `cal 01 1998` on the command line, you'll see that '98 falls under this rule. Also, if you run `cal 01 1999` you'll see that Jan 1st was a friday, i.e. the friday int eh last week of '98. So your code is right in one way that it's the 53rd week of the year, but wrong in that it's not telling you what year it's the 53rd week of (I think. I've had way too much coffee here).

Anyway, Austria is wrong,  so if there's no arguments about this bug, then I'll change Austria tomorrow and close this one off. 


###@###.### 2002-11-08

******** l10n evaluation template - begin ***********

Evaluation :
The problem as described in this bug is ok - German locale is OK.
Unfortunately, I've discovered that while German is EN 28601/ISO 8601 compliant,
a lot of our other european locales aren't.  

sccsdiff info (e.g. sccs diffs -r1.30 1.31 Activator_fr.java):

diffs are in attached file diff.txt

List file(s) to be delivered :
src/share/classes/sun/text/resources/LocaleElements_cs_CZ.java
src/share/classes/sun/text/resources/LocaleElements_da_DK.java
src/share/classes/sun/text/resources/LocaleElements_de_AT.java
src/share/classes/sun/text/resources/LocaleElements_el_GR.java
src/share/classes/sun/text/resources/LocaleElements_en_GB.java
src/share/classes/sun/text/resources/LocaleElements_en_IE.java
src/share/classes/sun/text/resources/LocaleElements_es_ES.java
src/share/classes/sun/text/resources/LocaleElements_et_EE.java
src/share/classes/sun/text/resources/LocaleElements_fi_FI.java
src/share/classes/sun/text/resources/LocaleElements_fr.java
src/share/classes/sun/text/resources/LocaleElements_is_IS.java
src/share/classes/sun/text/resources/LocaleElements_lt_LT.java
src/share/classes/sun/text/resources/LocaleElements_pl.java
src/share/classes/sun/text/resources/LocaleElements_pt_PT.java

Target Build : 
Mantis

Additional Info :
http://home.t-online.de/home/PeterJHaas/DateTime/wnden.htm

******** l10n evaluation template - end***********


###@###.### 2002-11-11

Adding one more file to the list: src/share/classes/sun/text/resources/LocaleElements_ca_ES.java

sccs diffs LocaleElements_ca_ES.java 

------- LocaleElements_ca_ES.java -------
51c51
<                     "1" // min days in first week
---
>                     "4" // min days in first week


###@###.### 2002-11-12
Need to back out some changes so I don't break JCK tests. Will need to re-update fr, nl_BE and en_GB next time around. 


As the above evaluation said, this bug hasn't entirely been fixed in Mantis.
Should be fixed in Tiger.
Need to file a bug report for JCK first.
###@###.### 2003-06-30


###@###.### 2003-10-13
******** l10n evaluation template - begin ***********

Evaluation :
fixing the rest of the files as mentioned above. 

sccsdiff info (e.g. sccs diffs -r1.30 1.31 Activator_fr.java):

sccs diffs `sccs tell`

------- LocaleElements_en_GB.java -------
72c72
<                     "1" // min days in first week
---
>                     "4" // min days in first week

------- LocaleElements_fr.java -------
486c486
<                     "1" // min days in first week
---
>                     "4" // min days in first week

------- LocaleElements_nl_BE.java -------
1c1
< /*
---
> y/*
64c64
<                     "1" // min days in first week
---
>                     "4" // min days in first week

List file(s) to be delivered :

src/share/classes/sun/text/resources/LocaleElements_en_GB.java
src/share/classes/sun/text/resources/LocaleElements_fr.java
src/share/classes/sun/text/resources/LocaleElements_nl_BE.java

Target Build : 
Tiger-beta

Additional Info :


******** l10n evaluation template - end***********
                                     
2004-06-11



Hardware and Software, Engineered to Work Together