May I override the date-string parser function on DateField ?

  1. #1

    May I override the date-string parser function on DateField ?

    Hi,

    I create a custom date-string format and parsing function on client using javascript as following
    
     var taiwanDateParse = function (date, strict) {
            var datePart = dateText.split("/");
            return new Date(parseInt(datePart[0]) + 1911, parseInt(datePart[1]), parseInt(datePart[2]));  
        };
    
       var taiwanDateFormat = function (date) {
    
            if (Ext.isEmpty(this) == false) {
                var year = this.getFullYear() - 1911;
                var month = this.getMonth() + 1;
                var day = this.getDate();
    
                return year + "/" + month + "/" + day;
            }
            else {
                return false;
            }
        };
    
        Date.parseFunctions['taiwan'] = taiwanDateParse;
    
        Date.formatFunctions['taiwan'] = taiwanDateFormat;
    Does it possible to customize the date-string parsing function on server-side ?

    I try to extend Datefield and override the property "Value", but it doesn't work.

    Any advice ?
  2. #2
    Ha... I should override the method "LoadPostData",

    and it works.

Similar Threads

  1. [CLOSED] Date is a string instead of Date object
    By deejayns in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 01, 2012, 2:10 PM
  2. Replies: 12
    Last Post: Jan 05, 2012, 11:39 AM
  3. Replies: 4
    Last Post: Nov 08, 2010, 6:00 AM
  4. [CLOSED] Override getValue() javascript function from numberField
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Sep 01, 2010, 6:26 PM
  5. Replies: 3
    Last Post: May 06, 2010, 12:48 PM

Posting Permissions