Results 1 to 4 of 4

Thread: Ext.Date.parse issue with French locale month

  1. #1

    Default Ext.Date.parse issue with French locale month

    Hello,

    I am trying to parse date with french month and it does not work. I even tried to over ride Date.monthNames.

    Code:
    Date.monthNames = [
        'Janvier',
        'Février',
        'Mars',
        'Avril',
        'Mai',
        'Juin',
        'Juillet',
        'Août',
        'Septembre',
        'Octobre',
        'Novembre',
        'Décembre'
    ];
    Date.monthNumbers = {
        'Jan': 0,
        'Fév': 1,
        'Mar': 2,
        'Avr': 3,
        'Mai': 4,
        'Jui': 5,
        'Jul': 6,
        'Aoû': 7,
        'Sep': 8,
        'Oct': 9,
        'Nov': 10,
        'Déc': 11
    };
    Ext.Date.parse('06 Août 2012', 'd M Y')
    Ext.Date.parse('06 Août 2012', 'd F Y')
    Both of the parse line give me undefined. Also, is there an official release for languages files such as ext-lang-fr-CA.js ? I can find them for ExtJs but I cannot find them for Touch

    Thank you




    ------------------------
    UPDATE :
    ------------------------


    I tried what maxusn suggested and it did not work.
    I am using Sencha 2.3.1


    Here is my new code :


    Code:
    Ext.Date.parse('06 Jan 2012', 'd M Y'); //works
    Ext.Date.parse('06 January 2012', 'd F Y'); //works
    
    
    
    
    
    
    
    
    Ext.Date.dayNames = [        
        "Dimanche",
        "Lundi",
        "Mardi",
        "Mercredi",
        "Jeudi",
        "Vendredi",
        "Samedi"
    ];
    
    
    
    
    Ext.Date.monthNames = [
        "Janvier",
        "Février",
        "Mars",
        "Avril",
        "Mai",
        "Juin",
        "Juillet",
        "Août",
        "Septembre",
        "Octobre",
        "Novembre",
        "Décembre"
    ];
    
    
    
    
    Ext.Date.monthNumbers = {
        "Janvier": 0,
        "Février": 1,
        "Mars": 2,
        "Avril": 3,
        "Mai": 4,
        "Juin": 5,
        "Juillet": 6,
        "Août": 7,
        "Septembre": 8,
        "Octobre": 9,
        "Novembre": 10,
        "Décembre": 11
    };
    
    
    
    
    
    
    
    
    Ext.Date.shortMonthNames = [
        "Janv",
        "Févr",
        "Mars",
        "Avr",
        "Mai",
        "Juin",
        "Juil",
        "Août",
        "Sept",
        "Oct",
        "Nov",
        "Déc"
    ];
    
    
    
    
    Ext.Date.getShortMonthName = function(month) {
        return Ext.Date.shortMonthNames[month];
    };
    
    
    
    
    Ext.Date.getShortDayName = function(day) {
        return Ext.Date.dayNames[day].substring(0, 3);
    };
    
    
    
    
    Ext.Date.getMonthNumber = function(name) {
    
        //return Date.monthNumbers[Ext.util.Format.capitalize(name)]; //was not working with Sencha Touch 2.3.1
        return Date.monthNumbers[Ext.String.capitalize(name)];
    };
    
    
    
    
    Ext.Date.getSuffix = function(date) {
        return (date.getDate() === 1) ? "er" : "";
    };
    
    
    
    
    Ext.Date.parse('06 Janv 2012', 'd M Y'); //Does not work; gives undefined
    Ext.Date.parse('06 Janvier 2012', 'd F Y'); //Does not work; gives undefined

  2. #2
    Sencha User
    Join Date
    May 2011
    Posts
    12
    Answers
    1

    Default

    Try Ext.Date.monthNames instead of Date.monthNames

    Sencha touch is different from Extjs.

  3. #3
    Sencha User
    Join Date
    Oct 2013
    Location
    France
    Posts
    36
    Answers
    2

    Default

    Hi, as shuixiya said, use "Ext.Date." :

    Code:
    Ext.Date.dayNames = [        
            "Dimanche",
            "Lundi",
            "Mardi",
            "Mercredi",
            "Jeudi",
            "Vendredi",
            "Samedi"
        ];
    
        Ext.Date.monthNames = [
            "Janvier",
            "Février",
            "Mars",
            "Avril",
            "Mai",
            "Juin",
            "Juillet",
            "Août",
            "Septembre",
            "Octobre",
            "Novembre",
            "Décembre"
        ];
    
        Ext.Date.monthNumbers = {
            "Janvier": 0,
            "Février": 1,
            "Mars": 2,
            "Avril": 3,
            "Mai": 4,
            "Juin": 5,
            "Juillet": 6,
            "Août": 7,
            "Septembre": 8,
            "Octobre": 9,
            "Novembre": 10,
            "Décembre": 11
        };
    
    
        Ext.Date.shortMonthNames = [
            "Janv",
            "Févr",
            "Mars",
            "Avr",
            "Mai",
            "Juin",
            "Juil",
            "Août",
            "Sept",
            "Oct",
            "Nov",
            "Déc"
        ];
    
    
    
    
        Ext.Date.getShortMonthName = function(month) {
            return Ext.Date.shortMonthNames[month];
        };
    
    
        Ext.Date.getShortDayName = function(day) {
            return Ext.Date.dayNames[day].substring(0, 3);
        };
    
    
        Ext.Date.getMonthNumber = function(name) {
            return Date.monthNumbers[Ext.util.Format.capitalize(name)];
        };
    
    
        Ext.Date.getSuffix = function(date) {
            return (date.getDate() === 1) ? "er" : "";
        };

  4. #4

    Default Error while formatting localized french date

    Hi,
    There is an issue while formatting localized french date.


    Ext.util.Format.date("Févr. 26, 1970 12:00 AM", "M d, Y h:i A") is unable to format localized date and returns Nan.

    Ext.util.Format.date invokes Date.parse("Févr. 26, 1970 12:00 AM") which is returning Nan.

    Is there any fix available for this issue?

    Thanks,
    Akshay

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •