[CLOSED] TimeField Localization Error

  1. #1

    [CLOSED] TimeField Localization Error

    Hello,

    We have an application using Ext.net 1.5 and we are getting the following error when using es-HN localization

    Server Error in '/' Application.
    --------------------------------------------------------------------------------
    
    String was not recognized as a valid TimeSpan. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    
    Exception Details: System.FormatException: String was not recognized as a valid TimeSpan.
    
    Source Error: 
    
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
    
    Stack Trace: 
    
    [FormatException: String was not recognized as a valid TimeSpan.]
       System.Globalization.TimeSpanParse.ProcessTerminal_HM(TimeSpanRawInfo& raw, TimeSpanStandardStyles style, TimeSpanResult& result) +3141383
       System.Globalization.TimeSpanParse.ProcessTerminalState(TimeSpanRawInfo& raw, TimeSpanStandardStyles style, TimeSpanResult& result) +9434416
       System.Globalization.TimeSpanParse.TryParseTimeSpan(String input, TimeSpanStandardStyles style, IFormatProvider formatProvider, TimeSpanResult& result) +222
       System.Globalization.TimeSpanParse.Parse(String input, IFormatProvider formatProvider) +68
       System.TimeSpan.Parse(String s) +6
       Ext.Net.TimeField.set_Value(Object value) in C:\Users\Geoffrey McGill\Documents\Visual Studio 2010\Projects\Ext.NET\v1\Ext.Net\Ext\Form\TimeField.cs:217
       Ext.Net.TimeField.LoadPostData(String postDataKey, NameValueCollection postCollection) in C:\Users\Geoffrey McGill\Documents\Visual Studio 2010\Projects\Ext.NET\v1\Ext.Net\Ext\Form\TimeField.cs:246
       Ext.Net.Field.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) in C:\Users\Geoffrey McGill\Documents\Visual Studio 2010\Projects\Ext.NET\v1\Ext.Net\Ext\Form\Field.cs:1156
       System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +327
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +878
    This is the declaration of the TimeField

    <ext:TimeField ID="ff_time_from" runat="server" Flex="1" Width="80" CausesValidation="false" />

    The locale is set through the "Ext.Net.Locale" Session variable and is set to the "es-HN" string.


    The field works fine if the localization is set to "en-US".
    Last edited by Daniil; Sep 03, 2012 at 5:05 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Welcome to Ext.NET!

    Thanks for the report. We will investigate.

    As a quick workaround I can suggest to set up
    Format="hh:mm"
    for the TimeField.
    Last edited by Daniil; Aug 24, 2012 at 1:41 PM.
  3. #3
    Unfortunately, there is no es-HN locale in ExtJS. Respectively, it is absent in Ext.NET as well.

    Only supported locales should be used to avoid the issues like the one you have faced. Or set up Format explicitly for TimeFields and DateFields.

    Or, maybe, you could use the es-ES locale.

    Though there is another issue. The following
    Format="hh:mm a"
    for TimeField causes the same exception.

    We will investigate a possibility to get it working with this Format.
  4. #4
    Quote Originally Posted by Daniil View Post
    Though there is another issue. The following
    Format="hh:mm a"
    for TimeField causes the same exception.

    We will investigate a possibility to get it working with this Format.
    My fault, I mixed .NET and PHP (ExtJS) date time formats.

    Must be:
    Format="hh:mm tt"
    By the way if you need "a.m./p.m.", please define this script within the page <head>.
    <script type="text/javascript">
        Ext.Date.formatCodes.a = "(this.getHours() < 12 ? 'a.m.' : 'p.m.')";
        Ext.Date.parseCodes.a.s = "(a.m.|p.m.|AM|PM)";
    </script>
  5. #5
    Unfortunately, there is no es-HN locale in ExtJS. Respectively, it is absent in Ext.NET as well.

    We have been using this locale on the whole project and also this was working in Ext.NET 1.3, when we switched the project to Ext.NET 1.5 we encountered this issue.

    Quote Originally Posted by Daniil View Post
    My fault, I mixed .NET and PHP (ExtJS) date time formats.

    Must be:
    Format="hh:mm tt"
    By the way if you need "a.m./p.m.", please define this script within the page <head>.
    <script type="text/javascript">
        Ext.Date.formatCodes.a = "(this.getHours() < 12 ? 'a.m.' : 'p.m.')";
        Ext.Date.parseCodes.a.s = "(a.m.|p.m.|AM|PM)";
    </script>
    How viable is this work-arround?
  6. #6
    Quote Originally Posted by BATCCA View Post
    We have been using this locale on the whole project and also this was working in Ext.NET 1.3, when we switched the project to Ext.NET 1.5 we encountered this issue.
    Good to know, I will check what caused this problem.

    Quote Originally Posted by BATCCA View Post
    How viable is this work-arround?
    Well, I can't say for 100% sure, but it should work well.
  7. #7
    Well, we will leave the page as English only since we are to close to release date, until you provide a guaranteed solution.
  8. #8
    Please clarify what exactly solution do you need?

    I don't think we can provide you with a better solution than setting up Format explicitly for TimeField.

    The es-HN locale is not supported in Ext.NET v1.3 as well. I don't know yet why your scenario works with v1.3. but I am not surprised it is broken.

    I think you can still use this locale, but please set up a required Format for TimeField explicitly. It would be good to set up Format for DateFields as well.
    Last edited by Daniil; Aug 27, 2012 at 5:01 PM.

Similar Threads

  1. [CLOSED] Localization
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Sep 21, 2012, 11:00 AM
  2. Replies: 11
    Last Post: Mar 08, 2012, 2:27 AM
  3. [CLOSED] Ext.NET + MVC 3 + Localization
    By jlosi in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 18, 2011, 8:20 PM
  4. Localization
    By ahmadezzeir in forum 1.x Help
    Replies: 13
    Last Post: Dec 21, 2010, 10:19 AM
  5. Localization and Skining
    By Dominik in forum 1.x Help
    Replies: 0
    Last Post: Mar 18, 2010, 11:19 AM

Tags for this Thread

Posting Permissions