nl-NL date format displayed wrong

  1. #1

    nl-NL date format displayed wrong

    Ext.NET 2.4.0 through NuGet
    ASP.NET 4.5.1
    Windows 8.1 Pro

    In the web.config I set globalization as followed:
    <globalization enableClientBasedCulture="false" culture="nl-NL" uiCulture="nl-NL"  />
    In the the application it is displaying all text in Dutch and numbers in Dutch format only the date format is displayed wrong.
    It is displaying:
    10/16/2014

    When I look at the extjs sources it should be:
    16-10-2014 'j-m-Y'
    Last edited by Daniil; Oct 16, 2014 at 1:02 PM. Reason: Please use [CODE] tags
  2. #2
    Hi @mturnhout,

    Is the localization JavaScript file attached to the page? There should be something like this:
    <script type="text/javascript" src="/extnet/locale/ext-lang-nl-js/ext.axd?v=16596"></script>
    When I look at the extjs sources it should be:
    16-10-2014 'j-m-Y'
    Please clarify where exactly do you see that?
  3. #3
    It's being attached:
    <script type="text/javascript" src="/extnet/locale/ext-lang-nl-js/ext.axd?v=10712"></script>
    Containing the following:
    Ext.define("Ext.locale.nl.form.field.Date", {
        override: "Ext.form.field.Date",
        disabledDaysText: 'Uitgeschakeld',
        disabledDatesText: 'Uitgeschakeld',
        minText: 'De datum in dit veld moet na {0} liggen',
        maxText: 'De datum in dit veld moet voor {0} liggen',
        invalidText: '{0} is geen geldige datum - formaat voor datum is {1}',
        format: 'j-m-y',
        altFormats: 'd/m/Y|d-m-y|d-m-Y|d/m|d-m|dm|dmy|dmY|d|Y-m-d'
    });
    Last edited by mturnhout; Oct 16, 2014 at 1:21 PM.
  4. #4
    The DateField's Format appears to be applied in the following test case. I choose today and it appears as "15-10-2014".

    Example
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" Locale="nl" />
    
            <ext:DateField runat="server" />
        </form>
    </body>
    </html>
    only the date format is displayed wrong
    Please clarify where exactly? I guess a DateColumn? Because I don't see an override for a DateColumn's format in the "nl" locale.
  5. #5
    Yes, sorry for not specifying this.

    Seems this is indeed the problem.
    The Dutch localization file hasn't been updated since '8 Aug 2008'.
    And is missing the override for BooleanColumn, NumberColumn, DateColumn and some other translations.

    NumberColumn same as German:
    Ext.define("Ext.locale.nl.grid.NumberColumn", {
        override: "Ext.grid.NumberColumn",
        format: '0.000,00/i'
    });
    DateColumn same format as DateField:
    Ext.define("Ext.locale.nl.grid.DateColumn", {
        override: "Ext.grid.DateColumn",
        format: 'j-m-y'
    });
    Not sure if it's usefull to translate the BooleanColumn but see the German one is:
    Ext.define("Ext.locale.nl.grid.BooleanColumn", {
        override: "Ext.grid.BooleanColumn",
        trueText: "waar",
        falseText: "vals"
    });
    What is the best/fastest way to get a proper update of the Dutch localization file in ExtJs -> Ext.Net -> Application?
    And also perhaps have a 'nl-BE' one added for customers in Belgium.

    Thanks for the help!
    Last edited by mturnhout; Oct 20, 2014 at 11:58 AM.
  6. #6
    I might correct the Dutch locale in SVN. As for Belgium one, it is unlikely we will incorporate it at this point, because there is no a good and clear mechanism to do that yet.

    In any way, it is just JavaScript. You can always attach any JavaScript code on the page manually.
  7. #7
    I'm now including the following:
    Ext.define("Ext.locale.nl.grid.NumberColumn", { override: "Ext.grid.NumberColumn", format: '0.000,00/i' });
    Ext.define("Ext.locale.nl.grid.DateColumn", { override: "Ext.grid.DateColumn", format: 'd-m-Y' });
    So if you could add it in SVN that would be great.
    That might save a javascript file include in every page that needs it.

    I think most people would rather have 'd-m-Y' 01-01-2014 instead of 'j-m-y' 1-01-14.
    For some reason DateField shows 1-1-2014 while 'j-m-y' is specified in the Dutch localization file.
    And 'd-m-Y' works for DateColumn but not for DateField where I need to use 'dd-MM-yyyy'.

    Is it possible to change/override already existing localization overrides?
    So I can change/override the NL format of the DateField to 'dd-MM-yyyy'.

    If you need any help with Dutch translations you can let me know.
    Belgium translation is not really needed, half know Dutch and most of them know French.
    Last edited by mturnhout; Oct 20, 2014 at 1:30 PM.
  8. #8
    So if you could add it in SVN that would be great.
    I have doubts on that.

    Let's consider:
    Ext.define("Ext.locale.nl.grid.NumberColumn", { override: "Ext.grid.NumberColumn", format: '0.000,00/i' });
    It appears that it is the number format by default. If put, for example, 10000000.64556 into a NumberColumn, it appears as "10.000.000,65". Is that correct or not?

    Let's consider:
    Ext.define("Ext.locale.nl.grid.DateColumn", { override: "Ext.grid.DateColumn", format: 'd-m-Y' });
    Currently, the "j-m-y" date format is used in the Dutch locale. So, I am reluctant to make such a change that a DateColumn have some format, but, for example, a DateField has another format.

    I think most people would rather have 'd-m-Y' 01-01-2014 instead of 'j-m-y' 1-01-14.
    Interesting, why "j-m-Y" has been appeared initially in the Dutch locale... I guess we are not going to change it at this point since it will be a too big override. Moreover, .NET Dutch localization shows "d-M-yyyy" for:
    System.Globalization.CultureInfo.CreateSpecificCulture("nl-NL").DateTimeFormat.ShortDatePattern
    And 'd-m-Y' works for DateColumn but not for DateField where I need to use 'dd-MM-yyyy'.
    If you set the server Format property, you should use .NET date format string. If you set it on client in JavaScript, you should use ExtJS (PhP) date format string.

    It is what ExtJS uses for date and time format strings:
    http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.Date

    Is it possible to change/override already existing localization overrides?
    So I can change/override the NL format of the DateField to 'dd-MM-yyyy'.
    There is a problem. By default, a DateField is always rendered with some format that equals to ShortDatePattern of the current locale. So, an instance's setting is always stronger than a class setting, so, this
    Ext.define("Ext.locale.nl.form.field.Date", {
        override: "Ext.form.field.Date",
        format: 'd-m-y'
    });
    is NOT going to work for any DateField control created from/on server side. It will work only if create a DateField via JavaScript.

    I don't see any good way to override the default format on client side.

    Only to set the required format for each DateField on server side.

    If you need any help with Dutch translations you can let me know.
    Thank you!

    Belgium translation is not really needed, half know Dutch and most of them know French.
    Good to know, thanks.
    Last edited by Daniil; Oct 22, 2014 at 5:58 AM.
  9. #9
    The only thing missing for now is indeed the DateColumn which is probable best to keep the same as DateField.

    Will have a look at inheriting the controls server side and setting the format from config when needed since it's for all users.
    I don't think we ever made controls client side since Ext.NET 1.0 so looks like a good solution.

    Thanks for the thorough answer!
  10. #10
    The only thing missing for now is indeed the DateColumn which is probable best to keep the same as DateField.
    Agree. I've created an Issue.
    https://github.com/extnet/Ext.NET/issues/581

    I added
    Ext.define("Ext.locale.nl.grid.DateColumn", { 
        override: "Ext.grid.DateColumn", 
        format: 'j-m-Y' 
    });
    in SVN.

    Though, there is still a few issues.

    1. The date format from "ext-lang-nl.js" (month with a leading zero) differ from .NET Dutch date format (month without a leading zero).

    2. Ext.NET DateFields are always rendered with Format (.NET date format string depending on the current locale), so, it doesn't pull the date format from the .js locale file. As for the DateColumn, they are not rendered with default Format, so, it pulls the date format from the .js locale file.

    It is quite annoying inconsistency, which we would love to correct at some point hopefully, but we have to live with that for now. Moreover, there is always a solution. Your solution with custom controls is really good.

Similar Threads

  1. Replies: 8
    Last Post: May 20, 2013, 4:01 AM
  2. Replies: 1
    Last Post: Apr 13, 2012, 1:52 PM
  3. [CLOSED] Wrong Date Format on the store
    By ViDom in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 25, 2011, 9:56 PM
  4. DatePicker: get Min Date and Max Date just displayed
    By Journeyman79 in forum 1.x Help
    Replies: 0
    Last Post: Mar 16, 2011, 10:41 AM
  5. [CLOSED] GridView wrong number of records displayed
    By alexp in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 15, 2009, 11:03 AM

Tags for this Thread

Posting Permissions