You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Simon Lessard (JIRA)" <de...@myfaces.apache.org> on 2007/08/17 19:46:31 UTC

[jira] Created: (TRINIDAD-634) chooseDate component ignores l10n for first day of week

chooseDate component ignores l10n for first day of week
-------------------------------------------------------

                 Key: TRINIDAD-634
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-634
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Components
    Affects Versions: 1.0.2-core, 1.2.2-core
            Reporter: Simon Lessard
            Assignee: Simon Lessard
            Priority: Minor


Currently, chooseDate always uses Sunday as the first day of the week because Calendar.getMinimum() does not take the localisation into account while getFirstDayOfWeek does. We've been told it's incorrect as many countries use Monday as the first day of the week.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TRINIDAD-634) chooseDate component ignores l10n for first day of week

Posted by "Mike Kienenberger (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-634?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602664#action_12602664 ] 

Mike Kienenberger commented on TRINIDAD-634:
--------------------------------------------

+  private static final int _DAYS_OF_WEEK = 7;

Also, would it be better to compute _DAYS_OF_WEEK as follows instead of hardcoding it to 7?

displayedCalendar.getMaximum(Calendar.DAY_OF_WEEK) - displayedCalendar.getMinimum(Calendar.DAY_OF_WEEK) + 1


> chooseDate component ignores l10n for first day of week
> -------------------------------------------------------
>
>                 Key: TRINIDAD-634
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-634
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.0.2-core, 1.2.2-core
>            Reporter: Simon Lessard
>            Assignee: Simon Lessard
>            Priority: Minor
>         Attachments: ChooseDateRenderer.patch
>
>
> Currently, chooseDate always uses Sunday as the first day of the week because Calendar.getMinimum() does not take the localisation into account while getFirstDayOfWeek does. We've been told it's incorrect as many countries use Monday as the first day of the week.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TRINIDAD-634) chooseDate component ignores l10n for first day of week

Posted by "Caius Gran (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-634?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698682#action_12698682 ] 

Caius Gran commented on TRINIDAD-634:
-------------------------------------

Could this fix get merged to the main? At least 1.0.10 still seems to be affected and requires manual patching.

> chooseDate component ignores l10n for first day of week
> -------------------------------------------------------
>
>                 Key: TRINIDAD-634
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-634
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.0.2-core, 1.2.2-core
>            Reporter: Simon Lessard
>            Assignee: Simon Lessard
>            Priority: Minor
>         Attachments: ChooseDateRenderer.patch
>
>
> Currently, chooseDate always uses Sunday as the first day of the week because Calendar.getMinimum() does not take the localisation into account while getFirstDayOfWeek does. We've been told it's incorrect as many countries use Monday as the first day of the week.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TRINIDAD-634) chooseDate component ignores l10n for first day of week

Posted by "Mike Kienenberger (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-634?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602661#action_12602661 ] 

Mike Kienenberger commented on TRINIDAD-634:
--------------------------------------------

-    int firstDOW = displayedCalendar.getMinimum(Calendar.DAY_OF_WEEK);
-    int lastDOW = displayedCalendar.getMaximum(Calendar.DAY_OF_WEEK);
-    int dowCount = lastDOW - firstDOW + 1;
+    int firstDOW = GregorianCalendar.getInstance(TimeZone.getDefault()).getFirstDayOfWeek();	    
+    int lastDOW =  firstDOW == Calendar.SUNDAY ? Calendar.SATURDAY : firstDOW - 1;	    
+    int dowCount = _DAYS_OF_WEEK ;
 

It would probably make more sense to calculate lastDOW using the following since there's no guarantee that SUNDAY is numerically the first day of the week.

+    int lastDOW =  firstDOW == displayedCalendar.getMinimum(Calendar.DAY_OF_WEEK) ? displayedCalendar.getMaximum(Calendar.DAY_OF_WEEK) : firstDOW - 1;	    


> chooseDate component ignores l10n for first day of week
> -------------------------------------------------------
>
>                 Key: TRINIDAD-634
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-634
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.0.2-core, 1.2.2-core
>            Reporter: Simon Lessard
>            Assignee: Simon Lessard
>            Priority: Minor
>         Attachments: ChooseDateRenderer.patch
>
>
> Currently, chooseDate always uses Sunday as the first day of the week because Calendar.getMinimum() does not take the localisation into account while getFirstDayOfWeek does. We've been told it's incorrect as many countries use Monday as the first day of the week.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TRINIDAD-634) chooseDate component ignores l10n for first day of week

Posted by "Rafael Pérez (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/TRINIDAD-634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rafael Pérez updated TRINIDAD-634:
----------------------------------

    Status: Patch Available  (was: Open)

> chooseDate component ignores l10n for first day of week
> -------------------------------------------------------
>
>                 Key: TRINIDAD-634
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-634
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.0.2-core, 1.2.2-core
>            Reporter: Simon Lessard
>            Assignee: Simon Lessard
>            Priority: Minor
>
> Currently, chooseDate always uses Sunday as the first day of the week because Calendar.getMinimum() does not take the localisation into account while getFirstDayOfWeek does. We've been told it's incorrect as many countries use Monday as the first day of the week.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.