taarifa / TaarifaTraders

Charter for Cross-Border Trade in Goods and Services
http://crossbordertrade.org
Other
3 stars 1 forks source link

Changing Date Format #2

Open fayazv opened 9 years ago

fayazv commented 9 years ago

Currently the date format is:

Fri, 20 Mar 2015 16:03:24 GMT

I want it to look like below in the front-end:

20/03/2015

I have tried the following:

<td>{{ trader.issue_date | date:"dd/MM/yyyy"}}</td>
<td ng-bind="trader.issue_date | date:'dd/MM/yyyy'"></td>

The result is the same. How do I change the date format?

kynan commented 9 years ago

Is your issue_date really a JavaScript Date object?

fayazv commented 9 years ago

I'm using _created instead of issue_date and the format it's stored in mongo is similar to date_recorded in TaarifaWaterpoints

fayazv commented 9 years ago

@kynan, @dgorissen any suggestions on this?

dgorissen commented 9 years ago

I would double check you fullfill the requirements:

Date to format either as Date object, milliseconds (string or number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is specified in the string input, the time is considered to be in the local timezone.

https://docs.angularjs.org/api/ng/filter/date