Results 1 to 5 of 5

Thread: How to format dates in an XTemplate?

Hybrid View

Previous Post Previous Post   Next Post Next Post
    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
    244
    Vote Rating
    2
      0  

    Question 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
    11
      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
    244
    Vote Rating
    2
      0  

    Default

    Thanks for the info!

  4. #4
    Ext Premium Member
    Join Date
    Sep 2009
    Posts
    48
    Vote Rating
    1
      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
    19
      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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •