I'm getting following error, when using amTimeAgo
pipe from angular2-moment.
Deprecation warning: value provided is not in a recognized RFC2822 or ISO format.
moment construction falls back to js Date(), which is not reliable across all browsers and versions.
Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release.
Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.
Arguments: [0] _isAMomentObject: true, _isUTC: false, _useUTC: false, _l: undefined, _i: 21-03-2017, _f: undefined, _strict: undefined, _locale: [object Object]
Also pipe is printing Invalid date
.
I'm using it like this:
<span class="date-created"> {{ job.createdAt | amTimeAgo }} </span>
And value of job.createdAt
is string in format: 22-03-2017
.
I understand that something is wrong with format, but don't know how to pass that custom format ('DD-MM-YYYY')
to pipe, so that moment
package and this angular library can recognize it.
Any ideas?
What about creating a new moment object to pass it into the pipe, like:
and in your html file: