Skip to content

Latest commit

 

History

History
88 lines (71 loc) · 2.88 KB

OLD_VERSION_README.md

File metadata and controls

88 lines (71 loc) · 2.88 KB

This documentation is valid for versions 1.x.x and lower

MomentTimezonePicker

NPM

npm version

Versions

Angular Version
8 1.x.x
7 0.x.x

Dependencies

For select input @ng-select/ng-select For time core moment-timezone

Getting started

Step 1: Install

NPM

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>

Step 4: Configuration

Inputs

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.

Outputs

Output Description
(onselect) Returns object with 5 keys (TZone)

Object: TZone

Field Type Example
abbr string GMT
group string Europe
nameValue string Europe/London
timeValue string +00:00
name string Europe/London (+00:00)

Contributor