Hybrid View

    Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-905 in a recent build.
  1. #1
    Ext JS Premium Member
    Join Date
    May 2008
    Location
    Austria, Vienna
    Posts
    213
    Vote Rating
    1
    abraxxa is on a distinguished road

      0  

    Question How to format dates in an XTemplate?

    How to format dates in an XTemplate?


    In ExtJS it's
    Code:
    {end_date:date("Y")}
    but that results in a "Uncaught TypeError: Property 'log' of object #<Object> is not a function" in sencha-touch-all-debug-w-comments.js:22810

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    10
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    It looks like we might have missed this functionality in the preview release. Expect this to be part of one of the upcoming releases.

  3. #3
    Ext JS Premium Member
    Join Date
    May 2008
    Location
    Austria, Vienna
    Posts
    213
    Vote Rating
    1
    abraxxa is on a distinguished road

      0  

    Default


    Thanks for the info!

  4. #4
    Ext Premium Member
    Join Date
    Sep 2009
    Posts
    48
    Vote Rating
    1
    yoh.suzuki is on a distinguished road

      0  

    Default


    You can format the date yourself inside XTemplate by binding your data like this:

    Code:
    {[values.end_date.format('Y')]} // works in Sencha Touch 1.0
    
    {[Ext.Date.format(values.end_date, 'Y')]} // works in Sencha Touch 2.0 (dev preview)

  5. #5
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    20
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      1  

    Default


    Quote Originally Posted by abraxxa View Post
    In ExtJS it's
    Code:
    {end_date:date("Y")}
    but that results in a "Uncaught TypeError: Property 'log' of object #<Object> is not a function" in sencha-touch-all-debug-w-comments.js:22810
    This will now work with the latest release.

    Alternatively, you could do something like:

    Code:
    {[Ext.util.Format.date(values.end_date, 'Y')]}

    Sencha Inc

    Jamie Avins

    @jamieavins