• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

[SOLVED] Issue with timefield

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [SOLVED] Issue with timefield

    I have a timefield defined in a form panel.

    Code:
    xtype : 'fieldcontainer',
    anchor : '30.25%',
    height : 22,
    layout : {
    	align : 'stretch',
    	type : 'hbox'
    },
    fieldLabel : 'Label',
    hideLabel : true,
    items : [{
    	xtype : 'datefield',
    	flex : 1,
    	fieldLabel : 'Count Date',
    	itemId: 'countDate',
    	name: 'countDate',
    	labelAlign : 'right',
    	value: new Date(),
    	labelWidth : 75
    }, {
    	xtype : 'timefield',
    	margin : '0 0 0 5',
    	flex : 1,
    	fieldLabel : 'Count Time',
    	itemId: 'countTime',
    	name: 'countTime',
    	value: new Date(),
    	increment: 15,
    	labelAlign : 'right',
    	format : 'g:i A',
    	altFormats : 'g:i A'
    }]
    I am making an AJAX call to the IBM i passing back JSON pairs to the front end. The value returning for countDate is 08/26/2013 and countTime is 08:57 AM. Here is how I am populating the fields.
    Code:
    this.getInventoryCountHeader().down('#countDate').setValue(data.COUNTDATE);
    this.getInventoryCountHeader().down('#countTime').setValue(data.COUNTTIME);
    Later when a button click event happens, I want to pass those values back to the IBM i. Here is how I am getting the values of the fields.
    Code:
    var countDate = this.getInventoryCountHeader().down('#countDate').getValue();
    var countTime = this.getInventoryCountHeader().down('#countTime').getValue();
    countDate now has a value of Mon Aug 26 2013 00:00:00 GMT-0400 (Eastern Daylight Time), countTime is null. It appears to me I am having an issue with the parse function when the countTime field has it's value set. What format do I pass to countTime so the field gets populated correctly?

  • #2
    Your format is 'g:i A'

    Lower case g indicates no leading zeros, but I see your hours have leading zeros. Try 'h:i A'

    Comment


    • #3
      I meant to also include that here is the potion of the API which defines the date format strings:

      http://docs.sencha.com/extjs/4.0.7/#!/api/Ext.Date

      Comment

      Working...
      X