Angular Date pipe not showing Date properly
I am using an angular date pipe on my page list.
{{ row.createdDate }} // 2019-11-04T06:32:24.352856
{{ row.createdDate | date: 'mm-dd-yyyy' }} // 32-04-2019
Here you go for an exact result.
"mm"
is minute format, u should capture it as "MM"
for month.
{{ row.createdDate }} // 2019-11-04T06:32:24.352856
{{ row.createdDate | date: 'MM-dd-yyyy' }} // 31-04-2019
and the date you captured is 32 is there any reason in that ?
Please use like this.
{{ row.createdDate | date: 'MM-dd-yyyy' }} // This will give you correct date.
You can visit here to check the valid format option available for Date Pipe.
https://angular.io/api/common/DatePipe
'mm' for minute
'MM' for months
{{ date | date: 'MM-dd-yyyy' }}
Examples are given in en-US locale.
'short': equivalent to 'M/d/yy, h:mm a' (6/15/15, 9:03 AM).
'medium': equivalent to 'MMM d, y, h:mm:ss a' (Jun 15, 2015, 9:03:01 AM).
'long': equivalent to 'MMMM d, y, h:mm:ss a z' (June 15, 2015 at 9:03:01 AM
GMT+1).
'full': equivalent to 'EEEE, MMMM d, y, h:mm:ss a zzzz' (Monday, June 15,
2015 at 9:03:01 AM GMT+01:00).
'shortDate': equivalent to 'M/d/yy' (6/15/15).
'mediumDate': equivalent to 'MMM d, y' (Jun 15, 2015).
'longDate': equivalent to 'MMMM d, y' (June 15, 2015).
'fullDate': equivalent to 'EEEE, MMMM d, y' (Monday, June 15, 2015).
'shortTime': equivalent to 'h:mm a' (9:03 AM).
'mediumTime': equivalent to 'h:mm:ss a' (9:03:01 AM).
'longTime': equivalent to 'h:mm:ss a z' (9:03:01 AM GMT+1).
'fullTime': equivalent to 'h:mm:ss a zzzz' (9:03:01 AM GMT+01:00).
mm
is minute, you should useMM