/** * @license * Copyright Google LLC 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); @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'}}
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'}}