Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    May 2009
    Posts
    2
    Vote Rating
    0
    maxbsousa is on a distinguished road

      0  

    Default Problem datefield format 'm/Y'

    Problem datefield format 'm/Y'


    When the computer's date is January 31 of any year, it happens a bug in the 'datefield' when the attribute 'format' is 'm/Y'. If you select any day of February, it changes to 31 March. This happens all the months that do not end with 31 (February, April, June, September and November). In testing, I changed the date of my machine to 31/01/2011. Can anyone help? Following is the code used.

    {
    xtype: 'datefield',
    fieldLabel: 'Month/Year',
    format: 'm/Y',
    allowBlank: false,
    listeners: {
    change: function(field, newValue, oldValue){
    alert(newValue);
    alert(field.getValue().format('d/m/Y'));
    alert(field.getValue().format('m/Y'));
    }
    }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,121
    Vote Rating
    453
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    The issue is that month 02 is actually that of March... months start at 0. Native javascript:

    new Date(2012, 02)

    Will give you March 01 2012
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    May 2009
    Posts
    2
    Vote Rating
    0
    maxbsousa is on a distinguished road

      0  

    Lightbulb


    Hello, thanks for the reply.
    The format 'm/Y' returns:
    'm': Numeric representation of a month, with leading zeros (01 to 12)
    'Y': A full numeric representation of a year, 4 digits (Examples: 1999 or 2003)
    To test:
    - Change the date of your system, for example, January 31, 2011.
    - Create a date field as the code I posted.
    - Select any day in the calendar month of February 2011.
    The value of the field should be shown in the '02/2011'. Right? But it shows '03/2011' which corresponds to the month of March. If I selected February because it showed in March?
    Do you understand the problem now? Is it a bug? Is there any override to correct this behavior?
    Thank you again.

Tags for this Thread