要在Angular 7应用程序中使用日期选择器时区,可以使用Angular的日期管道和日期选择器组件。以下是一个示例解决方案的代码示例:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { DatePipe } from '@angular/common';
@NgModule({
imports: [BrowserModule, FormsModule],
providers: [DatePipe],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
Selected Date: {{ selectedDate | date:'yyyy-MM-dd HH:mm:ss':'UTC' }}
import { Component } from '@angular/core';
import { DatePipe } from '@angular/common';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
selectedDate: string;
constructor(private datePipe: DatePipe) { }
}
请注意,这只是一个简单的示例,以演示如何在Angular 7中使用日期选择器时区。根据您的具体需求,您可能需要进行更多的自定义和配置。