Hi,
Before we had ASP.NET Zero we had to do this all ourselves, as a UK based company are date formats are different to most other places.
Is there anything in the framework to ease our pain for SPA and MPA or should we just use our own mix-and-match of workarounds ?
Thanks
John
3 Answer(s)
-
0
Hi,
If it's just a display format problem, you may try to use momentjs. It has wonderful formatting capabilities. We use it in AspNet Zero with momentFormat filter (<a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/master/src/MyCompanyName.AbpZeroTemplate.Web/App/common/filters/momentjs-filters.js">https://github.com/aspnetzero/aspnet-ze ... filters.js</a>)
For example, see DateTime format in Audit logs grid: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/master/src/MyCompanyName.AbpZeroTemplate.Web/App/common/views/auditLogs/index.js#L66">https://github.com/aspnetzero/aspnet-ze ... dex.js#L66</a> Default format is YYYY-MM-DD HH:mm:ss and you can change it easily. If you like, you can move it to a common js file and use it everywhere. Or you may move it to localization file and use based on current culture and so on...
Also, if you try an implementation and have a specific problem/question, I can try to help you.
Thanks.
-
0
Hi,
It was more around the POST'ing of values back, we've found that if we display in UK Format then we cannot post back as the binder doesn't like the date due to the month being on the wrong place.
I've solved it for now but wanted to get some best practice advice really.
Thanks
John
-
0
You may keep values in javascript as standard format and just format it in UK date for viewing. So, since your value in Angular Controller is not changed, it should not be a problem. If you share your solution, I can think on it to make it better (if possible). Thanks.