1. #1
    Sencha User wilzdezign's Avatar
    Join Date
    Jul 2011
    Location
    WA
    Posts
    65
    Vote Rating
    0
    wilzdezign is on a distinguished road

      0  

    Default Answered: Ext.util.Format.date() and date Index

    Answered: Ext.util.Format.date() and date Index


    I am using the Ext.Date guide to show formating of a date http://docs.sencha.com/touch/2-0/api/Ext.Date

    I am calling a JSONP feed to get some weather and it returns data as:
    PHP Code:
    {
        
    "date""2012-04-24",
        
    "precipMM""0.2",
        
    "tempMaxC""21",
        
    "tempMaxF""70"

    So the 'date' field returns '2012-04-24', however when I set up my Model fields, I used the convert to change it to "D. F d" format.
    PHP Code:
    fields: [
        { 
    name'date'type'date' },
        { 
    name'parseDate',
            
    convert: function(valuerecord){
                 return 
    Ext.util.Format.daterecord.get('date'), "D. F d" ); 
                      
    // however this reuturns "Mon. April 23" .. one day behind
           
    }
        }

    So the date() format section doesn't specify the day conversion as day-1 correct? The date '2012-04-24' should be formated/parsed as "Tues. April 24" ... am I missing something?

  2. The record should have a Date object and the view should format the date to what it needs.

    Code:
    fields : [
        { name : 'date', type : 'date', dateFormat : 'Y-m-d' }
    ]
    Now the date field should be a Date object and you can format via:

    Code:
    var date = record.getDate(),
        string = Ext.Date.format(date, ' Y');
    or in a list:

    Code:
    itemTpl : '{date:date("Y")}'

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,795
    Answers
    3466
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The record should have a Date object and the view should format the date to what it needs.

    Code:
    fields : [
        { name : 'date', type : 'date', dateFormat : 'Y-m-d' }
    ]
    Now the date field should be a Date object and you can format via:

    Code:
    var date = record.getDate(),
        string = Ext.Date.format(date, ' Y');
    or in a list:

    Code:
    itemTpl : '{date:date("Y")}'
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User wilzdezign's Avatar
    Join Date
    Jul 2011
    Location
    WA
    Posts
    65
    Vote Rating
    0
    wilzdezign is on a distinguished road

      0  

    Default


    So the end result is still the same, but more work using a convert function inside the Model fields? I guess that is less work so I removed the extra field entry and just changed the itemTpl with the date function on it. Thanks again!

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi