angularjs - breeze : Date Formatting -


i'm receiving dates server in format: thu apr 25 16:47:10 utc+0200 2013

the type date.

i want dates displayed in dd/mm/yyyy format. i've used moment.js , in initializer function of entity, called registerentitytypector, do:

myentity.createddate = moment.utc(myentity.createddate).format('dd/mm/yyyy'); 

although code returns formatted date, myentity.createddate remains same. if inspect in visual studio debugger , expand property, says 'prototype: invalid date'.

i have 2 questions: 1) doing right way ? i.e, it thing conversion in registerentitytypector ? 2) why not working :-) ?

breeze dates javascript dates. doing setting date property string. breeze attempts parse string, via javascript's date.parse method, date in order validate it. if fails, breeze leaves alone.

in general, if want format date properties, should not done in model, rather in view. in other words, wherever displaying dates, best location convert dates strings. if using binding library ko or angular, both provide mechanisms doing this, javascript template engines.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -