/** * @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 */ import {registerLocaleData} from '@angular/common'; import {Component} from '@angular/core'; // we need to import data for the french locale import localeFr from './locale-fr'; // registering french data registerLocaleData(localeFr); // #docregion DatePipe @Component({ selector: 'date-pipe', template: `

Today is {{today | date}}

Or if you prefer, {{today | date:'fullDate'}}

The time is {{today | date:'shortTime'}}

The full date/time is {{today | date:'full'}}

The full date/time in french is: {{today | date:'full':'':'fr'}}

The custom date is {{today | date:'yyyy-MM-dd HH:mm a z':'+0900'}}

The custom date with fixed timezone is {{fixedTimezone | date:'yyyy-MM-dd HH:mm a z':'+0900'}}

` }) export class DatePipeComponent { today = Date.now(); fixedTimezone = '2015-06-15T09:03:01+0900'; } // #enddocregion // #docregion DeprecatedDatePipe @Component({ selector: 'deprecated-date-pipe', template: `

Today is {{today | date}}

Or if you prefer, {{today | date:'fullDate'}}

The time is {{today | date:'shortTime'}}

The custom date is {{today | date:'yyyy-MM-dd HH:mm a'}}

` }) export class DeprecatedDatePipeComponent { today = Date.now(); } // #enddocregion