title: Angular date format with if condition
body: <p>I have following angular:</p>
  
  <pre><code>ngOnInit(){
     this.getInfo().then((data) =&gt; {               
          this.allInfo= data;           
      });
  };
  </code></pre>
  
  <p>...where the <code>data</code> looks like below:</p>
  
  <pre><code>0:
    Time: 1508218791131
  1:
    Time: 1508217179413
  2:
    Time: 1508217026810
  </code></pre>
  
  <p>Then, in html:</p>
  
  <pre><code>&lt;div *ngFor = "let each of allInfo;" &gt;
      &lt;div&gt;{{ each.Time | date : "shortTime" }}&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>These works just fine.</p>
  
  <p><strong>Here is what I am trying to do:</strong></p>
  
  <p>I am trying to compare the <code>Time</code> to the <code>current time</code> with two conditions:</p>
  
  <ol>
  <li>If it has been <strong>less</strong> than 24 hours compared to the current time, then use "shortTime" giving <code>11:10 pm</code></li>
  <li>If it has been <strong>more</strong> than 24 hours compared to the current time, then use "MMM d" giving <code>Oct 16</code>.</li>
  </ol>
  
  <p>How do I add the if condition to the syntax inside of ngFor?</p>