[CLOSED] Localisation - DatePicker in Italian

  1. #1

    [CLOSED] Localisation - DatePicker in Italian

    Hi,

    When using the date picker for the culture it-IT, selectedDate is not set correctly. It works for other european cultures no problem.

    Quick sample: Set browser language to Italian to see fail - label result is always 01/01/0001

    <ext:ScriptManager runat="server" />
    <ext:DatePicker ID="dateTest" runat="server" />
    <ext:Button ID="btnSetDate" runat="server" Text="Set Date">
        <AjaxEvents>
            <Click OnEvent="btnSetDate_Click" />
        </AjaxEvents>
    </ext:Button>
    <ext:Label ID="lblDate" runat="server" />
    Public Sub btnSetDate_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        lblDate.Text = dateTest.SelectedDate.ToString("d")
    End Sub
    Justin
  2. #2

    RE: [CLOSED] Localisation - DatePicker in Italian

    Hi,

    I set IE Language preferences to Italian, set Locale="Client" for ScriptManager to automatically set locale depending browser language and it works fine.

    Here is my test sample
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
    <script runat="server">
        protected void btnSetDate_Click(object sender, AjaxEventArgs e)
        {
            lblDate.Text = dateTest.SelectedDate.ToString("d");
        }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" Locale="Client" />
            
            <ext:DatePicker ID="dateTest" runat="server" />
            <ext:Button ID="btnSetDate" runat="server" Text="Set Date">
                <AjaxEvents>
                    <Click OnEvent="btnSetDate_Click" />
                </AjaxEvents>
            </ext:Button>
            <ext:Label ID="lblDate" runat="server" />
    
        </form>
    </body>
    </html>
    Also I set Locale="it-IT" and it works correct as well

    Can you provide more details and source code?
  3. #3

    RE: [CLOSED] Localisation - DatePicker in Italian

    Thanks for the quick reply.


    Based on yours working and mine not, I looked deeper and realised I had the following in my web.config


    <globalization uiCulture="auto" culture="auto" />

    Removing that setting solved the issue, I'm guessing things were getting mixed up somewhere.


    Justin
  4. #4

    RE: [CLOSED] Localisation - DatePicker in Italian

    Hi Vladimir,

    Using your code example but adding the following to the Page Init method

    (Sorry, back in VB again...)

    Dim cultureString As String = Request.UserLanguages(0)
    System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo(cultureString)
    System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(cultureString)
    Page.Culture = CultureInfo.CurrentCulture.Name
    Page.UICulture = CultureInfo.CurrentUICulture.Name
    I've tracked the issue down to line 75 of datePicker.cs

    this.SelectedDate = DateTime.ParseExact(val, @"yyyy-MM-ddThh:mm:ss", System.Threading.Thread.CurrentThread.CurrentCulture);
    which, once changed to

    this.SelectedDate = DateTime.Parse(val, System.Threading.Thread.CurrentThread.CurrentCulture);
    Solves the issue.

    I've tried a solution as detailed at

    http://madskristensen.net/post/Quirk...ime-class.aspx

    with no success.

    In the immediate window, even trying to run the line:

    ?DateTime.ParseExact("2009-04-26T12:00:00", "yyyy-MM-ddThh:mm:ss", System.Threading.Thread.CurrentThread.CurrentCulture)
    results in the same error.

  5. #5

    RE: [CLOSED] Localisation - DatePicker in Italian

    I've reproduced the problem. Investigating...

    Geoffrey McGill
    Founder
  6. #6

    RE: [CLOSED] Localisation - DatePicker in Italian

    Using:

    this.SelectedDate = DateTime.ParseExact(val, @"yyyy-MM-ddThh\:mm\:ss", System.Threading.Thread.CurrentThread.CurrentCulture);
    in DatePicker.cs

    Seems to do the trick.

  7. #7

    RE: [CLOSED] Localisation - DatePicker in Italian

    Am I

    Dim

    I can't seem to get code formatting to work...
  8. #8

    RE: [CLOSED] Localisation - DatePicker in Italian

    Newlines?


    Dim

    Dim
  9. #9

    RE: [CLOSED] Localisation - DatePicker in Italian

    Hi Justin,

    I've committed a fix. The fix does escape the ISO datetime format which appears to solve the problem based on my testing.

    Please svn update and let us know if things are working better now.

    Thanks for originally pointing out the problem. That's a pretty obscure defect.

    Geoffrey McGill
    Founder
  10. #10

    RE: [CLOSED] Localisation - DatePicker in Italian

    That's done the trick. Thanks.

Similar Threads

  1. [CLOSED] DatePicker:
    By RomualdAwessou in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Jul 09, 2010, 2:50 PM
  2. [CLOSED] datepicker from to example
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 04, 2010, 2:29 PM
  3. [CLOSED] DatePicker
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Dec 18, 2008, 4:31 AM
  4. [CLOSED] Datepicker help
    By Jurke in forum 1.x Help
    Replies: 13
    Last Post: Sep 22, 2008, 6:52 AM
  5. coolite italian blog post
    By davidee in forum Open Discussions
    Replies: 0
    Last Post: Apr 13, 2008, 3:32 PM

Posting Permissions