Reputation: 373
I use the TIME
data type. And my data is displayed in the format hh:mm:ss
(03:14:00). How can I display the data in the format hh:mm
(03:14)? DATE type method does not work:
{{test.time | date: 'HH:mm'}}
It will simply produce such an error.
Error: InvalidPipeArgument: 'Unable to convert "03:14:00" into a date' for pipe 'DatePipe'
Upvotes: 1
Views: 180
Reputation: 652
Try giving it the start of any date, and concatenate the time onto that.
{{"1970-01-01T"+test.time | date: 'HH:mm'}}
Upvotes: 4
Reputation: 161
May not be an apt solution. But one way can be to take the hh:mm:ss time into a string var and then split the string to remove the last 3 characters
Upvotes: 0