terrabl
terrabl

Reputation: 924

Formatting a Datetime in Angular/Ionic

I was wondering how I can format the text and make some part of the datetime string bold?

For example I want to make my current date time format, which looks like: 02/19/2018 16:00 CST to 02/19/2018 16:00 CST.

This is the code that is generating the current date time format.

<td{{ visit['end_dte'] | date:'MM/dd/yyyy HH:mm Z'}}</td>

I tried doing <td{{ visit['end_dte'] | date:'MM/dd/yyyy <b>HH:mm Z</b>'}}</td> but it made it so that the pipe was represented as text instead of bolding the time.

Upvotes: 0

Views: 428

Answers (1)

Isaac
Isaac

Reputation: 11805

Separate it into 2 different filter calls

<td>
  {{ visit['end_dte'] | date:'MM/dd/yyyy'}} <b>{{ visit['end_dte'] | date:'HH:mm Z'}}</b>
</td>

Upvotes: 5

Related Questions