[CLOSED] TimeFields problem with 12-hour clock

  1. #1

    [CLOSED] TimeFields problem with 12-hour clock

    Hello,

    I have the following page (it is your example modified):

    <%@ 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>TimeField Control Variations - Coolite Toolkit Examples</title>
        <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
        
        <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!Ext.IsAjaxRequest)
                {
                    this.TimeField1.SelectedTime = DateTime.Now.TimeOfDay;                   
                }
            }
            
            protected void SwapValues(object sender, AjaxEventArgs e)
            {
                TimeSpan time1 = TimeField1.SelectedTime;
                TimeSpan time2 = TimeField2.SelectedTime;
    
                TimeField1.SelectedTime = time2;
                TimeField2.SelectedTime = time1;
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" />
           
            <h1>TimeField Control Variations</h1>
            <br />
            
            <h2>1. 12-hour time format</h2>    
            <ext:TimeField ID="TimeField1" runat="server" Increment="30" />
            
            <br />
            <br />
            
            <h2>2. 24-hour time format</h2>    
            <ext:TimeField ID="TimeField2" runat="server" Increment="30" SelectedTime="09:00" Format="H:mm" />
            
            <br />
            <br />
            
            <ext:Button runat="server" Text="Swap selected values" Icon="ArrowInout">
                <AjaxEvents>
                    <Click OnEvent="SwapValues"></Click>
                </AjaxEvents>
            </ext:Button>
        </form>
        
    </body>
    </html>
    When I select 12 am in the 12-hour time field and click swap for the first time then the 12-hour time field gets 9 pm instead of 9 am. When I click swap again, 12-hour time field gets 12 pm instead of 12 am.

    Is there an additional setting to fix that?

    Regards,
    Tadeusz
  2. #2

    RE: [CLOSED] TimeFields problem with 12-hour clock

    Hi,

    This example is out of date. We need update it. At this moment if you did not set Format explicitly then will be used current culture format (therefore it can be other then 12 hour format)*


    What your current server side culture?
  3. #3

    RE: [CLOSED] TimeFields problem with 12-hour clock

    Hi,

    I set the server culture to English(US), so the hours were in 12 hour format (I could see that in the drop down box). When I set explicitly the format to Format="hh:mm tt", which should be 12-hour format I receive an error. Regardless of that, when I set TimeField.SelectedTime to new TimeSpan(0, 0, 0), the when I read back the TimeField.SelectedTime right after that, it returns TimeSpan(12, 0, 0), which is incorrect. This happens with 12 hour format and not with 24 hour format.
  4. #4

    RE: [CLOSED] TimeFields problem with 12-hour clock

    Hi tdracz,

    There is a defect in the TimeField parsing. We're working on a fix and should be able to post an update shortly.

    Geoffrey McGill
    Founder
  5. #5

    RE: [CLOSED] TimeFields problem with 12-hour clock

    This TimeField parsing defect has been fixed. The fix has been committed to svn and will be available with the upcoming v0.8.2 and v1.0 releases.

    Geoffrey McGill
    Founder

Similar Threads

  1. how to change the hour in the demo My Calendar
    By diego0404 in forum 1.x Help
    Replies: 2
    Last Post: Feb 01, 2012, 12:03 AM
  2. Compare values from 2 TimeFields
    By AlexMaslakov in forum 1.x Help
    Replies: 5
    Last Post: Sep 14, 2011, 1:08 PM
  3. [CLOSED] Cascading TimeFields with at least 30 Minutes between
    By macap in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 15, 2010, 7:34 AM
  4. Replies: 5
    Last Post: Jun 10, 2009, 5:13 AM

Posting Permissions