Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Nov 2009
    Location
    Uruguay
    Posts
    47
    Vote Rating
    0
    milton9480 is on a distinguished road

      0  

    Default Format datepickerfield result.

    Format datepickerfield result.


    Hi guys,

    I'd like to know how to format the result of a datepickerfield, to leave the text as mmm dd, yyyy (ie September 12, 2011).
    I've tried different approaches found in the web, but without luck.
    Here is my current code, and after a date is picked (also at start because I'm setting today as default), the date text field shows in mm/dd/yyyy format.

    Code:
    {                    id: 'id_dateField',
                        xtype: 'datepickerfield',
                        dateformat: 'F j, Y',
                        type: 'date',
                        value: {
                            day: Date.today().getDate(),
                            month: Date.today().getMonth() + 1,
                            year: Date.today().getFullYear()
                        },
                        picker: {
                            doneButton: 'Search',
                            slotOrder: ['month', 'day', 'year'],
                            useClearIcon: true,
                            hideOnMaskTap: true,
                        },
                        name : 'date',
                        label: 'Date',
                        inputCls: 'inputRightAligned'
                    }
    Tks in advance!
    Regards,
    Milton Rodriguez

  2. #2
    Sencha User
    Join Date
    Nov 2009
    Location
    Uruguay
    Posts
    47
    Vote Rating
    0
    milton9480 is on a distinguished road

      0  

    Default Unanswered Format datepickerfield result.

    Unanswered Format datepickerfield result.


    Hi guys, any one that can help me on that ?

  3. #3
    Sencha User
    Join Date
    Nov 2009
    Location
    Uruguay
    Posts
    47
    Vote Rating
    0
    milton9480 is on a distinguished road

      0  

    Default [Solved] Format datepickerfield result

    [Solved] Format datepickerfield result


    Well, sadly I've not found an answer in the forum, and nobody answer my question, so, doing more researches and mixing between Ext.js, sencha and others resources found in internet, plus some creativity, I've a very simple solution. Just add listeners to the datepickerfield for change and afterrender events (last one for initial date) and set the dom element value with the picker value parsed.
    At the end, the form item must looks like the following:
    Code:
    {
          xtype: 'datepickerfield',
          name: 'date',
          label: 'Date',
          inputCls: 'inputRightAligned',
          value: {
                day: Date.today().getDate(),
                month: Date.today().getMonth() + 1,
                year: Date.today().getFullYear()
          },
          picker: {
                slotOrder: ['month', 'day', 'year'],
                useClearIcon: true,
                hideOnMaskTap: true,
                doneButton: 'Search'
          },
          listeners: {
                afterrender: function() {
                      this.fieldEl.dom.value = this.getValue().toString("MMMM d, yyyy");
                },
                change: function() {
                      this.fieldEl.dom.value = this.getValue().toString("MMMM d, yyyy");
                }
          }
    }

  4. #4
    Sencha Premium Member
    Join Date
    May 2010
    Posts
    48
    Vote Rating
    2
    Materix is on a distinguished road

      0  

    Default


    Nice solution. But I am a bit surprised fo find that Sencha does not have a dateformat property?

  5. #5
    Sencha User
    Join Date
    Jun 2012
    Posts
    6
    Vote Rating
    0
    huypham612 is on a distinguished road

      0  

    Default


    Hi, this is another simple solution to format datepickerfield result as provided here http://docs.sencha.com/touch/2-0/#!/api/Ext.Date

    var formValues = form.getValues();
    var dt = new Date(formValues.birthday); //birthday is the datepickerfield result
    dt = Ext.Date.format(dt,'F d, Y') ;

    Have fun coding.

Thread Participants: 2

Tags for this Thread