PDA

View Full Version : [FIXED] How to format dates in an XTemplate?



abraxxa
15 Oct 2011, 5:17 PM
In ExtJS it's

{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

TommyMaintz
19 Oct 2011, 7:51 AM
It looks like we might have missed this functionality in the preview release. Expect this to be part of one of the upcoming releases.

abraxxa
19 Oct 2011, 8:01 AM
Thanks for the info!

yoh.suzuki
19 Oct 2011, 5:16 PM
You can format the date yourself inside XTemplate by binding your data like this:


{[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)

Jamie Avins
19 Jan 2012, 12:09 PM
In ExtJS it's

{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:


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