This documentation is valid for versions 1.x.x and lower
Angular
Version
8
1.x.x
7
0.x.x
For select input @ng-select/ng-select
For time core moment-timezone
npm i moment-timezone-picker --save
Step 2: Import the MomentTimezonePickerModule
import { BrowserModule } from '@angular/platform-browser' ;
import { NgModule } from '@angular/core' ;
import { AppComponent } from './app.component' ;
import { MomentTimezonePickerModule } from 'moment-timezone-picker' ; //add this
@NgModule ( {
declarations : [
AppComponent
] ,
imports : [
BrowserModule ,
MomentTimezonePickerModule //add this
] ,
providers : [ ] ,
bootstrap : [ AppComponent ]
} )
export class AppModule { }
Step 3: Add in component html
< ng-moment-timezone-picker (onselect) ="yourFunc($event) "
[customPlaceholderText] ="yourText ">
</ ng-moment-timezone-picker >
Input
Type
Default
Required
Description
[customPlaceholderText]
string
Choose...
no
Allows you to localize the placeholder text.
[customNotFoundText]
string
No zone found
no
Allows you to localize not found text
[getUserZone]
boolean
false
no
Allows you to guess user timezone. If true
also emits value on init.
[setZone]
string
null
no
Allows to set default zone on init. Example America/Los_Angeles
.
Output
Description
(onselect)
Returns object with 5 keys (TZone)
Field
Type
Example
abbr
string
GMT
group
string
Europe
nameValue
string
Europe/London
timeValue
string
+00:00
name
string
Europe/London (+00:00)