mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
cleanup(datepicker): undo breaking change to NativeDateAdapter (#8281)
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {PlatformModule} from '@angular/cdk/platform';
|
||||
import {NgModule} from '@angular/core';
|
||||
import {DateAdapter, MAT_DATE_LOCALE_PROVIDER} from './date-adapter';
|
||||
import {MAT_DATE_FORMATS} from './date-formats';
|
||||
@@ -20,7 +19,6 @@ export * from './native-date-formats';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [PlatformModule],
|
||||
providers: [
|
||||
{provide: DateAdapter, useClass: NativeDateAdapter},
|
||||
MAT_DATE_LOCALE_PROVIDER
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Platform} from '@angular/cdk/platform';
|
||||
import {Inject, Injectable, Optional} from '@angular/core';
|
||||
import {extendObject} from '../util/object-extend';
|
||||
import {DateAdapter, MAT_DATE_LOCALE} from './date-adapter';
|
||||
@@ -69,12 +68,15 @@ export class NativeDateAdapter extends DateAdapter<Date> {
|
||||
*/
|
||||
useUtcForDisplay: boolean;
|
||||
|
||||
constructor(@Optional() @Inject(MAT_DATE_LOCALE) matDateLocale: string, platform: Platform) {
|
||||
constructor(@Optional() @Inject(MAT_DATE_LOCALE) matDateLocale: string) {
|
||||
super();
|
||||
super.setLocale(matDateLocale);
|
||||
|
||||
// IE does its own time zone correction, so we disable this on IE.
|
||||
this.useUtcForDisplay = !platform.TRIDENT;
|
||||
// TODO(mmalerba): replace with !platform.TRIDENT, logic currently duplicated to avoid breaking
|
||||
// change from injecting the Platform.
|
||||
this.useUtcForDisplay = !(typeof document === 'object' && !!document &&
|
||||
/(msie|trident)/i.test(navigator.userAgent));
|
||||
}
|
||||
|
||||
getYear(date: Date): number {
|
||||
|
||||
Reference in New Issue
Block a user