0

I have an ExtJS field as:

field = {
    xtype : 'datefield',
    format : 'Y/m/d',
    draggable : true,
    allowBlank : true,
    pickerAlign : 'tr-br',
    getValue : function()
    {
        return this.getRawValue();
    }
};

This works fine and I get the date in the field in the specified format. I want to be able the parse the date coming in from the datepicker and then display the date in locale specific format. How do I do it?

Chiranjib
  • 1,763
  • 2
  • 17
  • 29

1 Answers1

0
field = {
    xtype: 'datefield',
    format: 'Y/m/d',
    draggable: true,
    allowBlank: true,
    pickerAlign: 'tr-br',
    isValid : function()
    {
        return true;
    },
    setValue : function(value)
    {
        var valueToSet = "";
        if (value)
        {
            valueToSet = moment(value).lang(lang + "-" + cntry).format('L');
        }
        this.setRawValue(valueToSet);
    },
    getValue: function () {
        return this.getRawValue();
    }
};
Community
  • 1
  • 1
Chiranjib
  • 1,763
  • 2
  • 17
  • 29