Results 1 to 3 of 3

Thread: Date field, hitting tab while incomplete creates wonky date

  1. #1
    Ext JS Premium Member
    Join Date
    Jan 2008
    Location
    Virginia
    Posts
    34
    Vote Rating
    1
      0  

    Default Date field, hitting tab while incomplete creates wonky date

    Behavior:

    I have a datefield. This is using a custom validator function config.

    If I type "2011" into the date field, then hit tab to the next field, it auto populates the field with 2012-08-11

    I have no idea why this is happening. Any thoughts?

    Code:
    new Ext.form.DateField({
    	            applyTo: "id_financialaccount_"+id+"-opened_date",
    	            format: "Y-m-d",
    	            width : 100,
    	            value : record.get('opened_date'),
    	            allowBlank: false,
    	            id: 'ext_opened_date_'+id,
    	            regex: /^[0-9]{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$/,
    	            regexText: 'Please enter a date in YYYY-MM-DD format',
    	            enableKeyEvents: true,
                    
                    validator: function(value) {
                		}
    	        });

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    119
      0  

    Default

    It depends on your altFormats config option (I don't know which locale you are using).

    Another issue could be date rollover. If you don't want that, then use:
    Code:
    Date.useStrict = true;

  3. #3
    Ext JS Premium Member
    Join Date
    Jan 2008
    Location
    Virginia
    Posts
    34
    Vote Rating
    1
      0  

    Default

    Ok so date.usestrict fixed the odd tabbing behavior. However, now a data grid that I have which is using a date is no longer displaying the date properly. Example, ajax is returning this:

    Code:
    "created_on": "2011-02-18 19:10:33.368224"
    the record definition is as follows:

    Code:
    {name: 'created_on', mapping: 'Attachment.created_on', type : 'date', dateFormat : 'Y-m-d H:i:s.u'}
    the grid column definition is as follows:

    Code:
    {header : 'Date', sortable : true, dataIndex : 'created_on', renderer : Ext.util.Format.dateRenderer('m/d/Y'), width: 200}
    removing the date.usestrict line results in the date properly showing up in my grid.

Similar Threads

  1. How to set month start date month end date default in date field
    By frank_ash in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 17 Oct 2008, 6:59 AM
  2. Week Number in Date field / Date Packer
    By speedytangent in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 15 Oct 2008, 2:01 AM
  3. Newbie Question about disable shadow of the date picker's date field
    By fm424946 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 13 Nov 2007, 9:02 AM

Posting Permissions

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