2016-06-23 12:47:54 -04:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2016-08-16 14:15:01 -04:00
|
|
|
import {Component, NgModule} from '@angular/core';
|
|
|
|
import {BrowserModule} from '@angular/platform-browser';
|
|
|
|
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
2015-11-02 18:46:59 -05:00
|
|
|
|
|
|
|
// #docregion DatePipe
|
|
|
|
@Component({
|
|
|
|
selector: 'date-example',
|
|
|
|
template: `<div>
|
|
|
|
<p>Today is {{today | date}}</p>
|
|
|
|
<p>Or if you prefer, {{today | date:'fullDate'}}</p>
|
|
|
|
<p>The time is {{today | date:'jmZ'}}</p>
|
|
|
|
</div>`
|
|
|
|
})
|
|
|
|
export class DatePipeExample {
|
|
|
|
today: number = Date.now();
|
|
|
|
}
|
|
|
|
// #enddocregion
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'example-app',
|
|
|
|
template: `
|
|
|
|
<h1>DatePipe Example</h1>
|
|
|
|
<date-example></date-example>
|
|
|
|
`
|
|
|
|
})
|
|
|
|
export class AppCmp {
|
|
|
|
}
|
|
|
|
|
2016-08-19 15:51:01 -04:00
|
|
|
@NgModule({declarations: [DatePipeExample, AppCmp], imports: [BrowserModule], bootstrap: [AppCmp]})
|
2016-08-16 14:15:01 -04:00
|
|
|
class AppModule {
|
2015-11-02 18:46:59 -05:00
|
|
|
}
|
2016-08-16 14:15:01 -04:00
|
|
|
|
|
|
|
export function main() {
|
|
|
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
2016-08-19 15:51:01 -04:00
|
|
|
}
|