Created
April 3, 2020 12:44
-
-
Save Qarun-Qadir-Bissoondial/96313b62cad03e541b615f0329e515de to your computer and use it in GitHub Desktop.
Pipes Demo - Date Pipe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
@Component({ | |
selector: 'app-date-pipe', | |
template: ` | |
<p>Date without Pipe: {{date}}</p> | |
<p>Date with Pipe: {{date | date}} </p> | |
<h3>Showing Dates</h3> | |
<p>Short Date: {{date | date:'shortDate'}}</p> | |
<p>Medium Date: {{date | date:'mediumDate'}}</p> | |
<p>Long Date: {{date | date:'longDate'}}</p> | |
<h3>Dates with Parameters</h3> | |
<p>dd/mm/yyyy: {{date | date:'d MMM y'}}</p> | |
<p>yyyy/mm/dd: {{date | date:'y MMM d'}}</p> | |
<h3>Formatting Times</h3> | |
<p>Short time: {{date | date:'shortTime'}}</p> | |
<p>Medium time: {{date | date:'mediumTime'}}</p> | |
<p>Long time: {{date | date:'longTime'}}</p> | |
`, | |
styleUrls: [] | |
}) | |
export class DatePipeComponent { | |
date: Date = new Date(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment