I got a ISO formatted Date from my Data and what I actually want to do, is to modify my date format directly from my Templates.
like this:
{{format my.context.date "myFormat"}}
I'm using the moment library, so I could write something like this:
{{formatDate my.context.date "DD.MM.YYYY HH:mm"}} // 03.09.2013 18:12
It would be nice, because I think it's the place where I should be able to do this. In my template.
The solution is quite simple, and maybe someone will find it useful. In most projects you have a couple of date formats you want to use. So it's a good approach to define your formats with readable names.
For this example I took just 'short' and 'long', but you will see, it's very easy to extend.
So I created an Object in my Client Script:
Also, I created a Handlebars Helper "formatDate".
Edited: Now you should use UI instead of Handlebars
As you can see, I use the moment.js lib in my Helper. To install it, just type
meteor add momentjs:moment
from your command line.And now, everywhere in my Templates I can use it with the two params, like this:
If you want to create your own formats, take a look at the momentjs docs http://momentjs.com/docs/
Happy coding!