9.0.0 • Published 3 months ago

moment-timezone-picker v9.0.0

Weekly downloads
778
License
MIT
Repository
github
Last release
3 months ago

MomentTimezonePicker

NPM

npm version npm.io npm.io npm.io npm.io npm.io npm.io

Versions

AngularVersion
179.x.x
168.x.x
157.x.x
146.x.x
135.x.x
124.x.x
113.x.x
102.x.x
81.x.x
70.x.x

For older version see OLD_VERSIONS_README.md

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

1) As model

<ng-moment-timezone-picker [(ngModel)]="yourModel">
</ng-moment-timezone-picker>

2) As reactive form

<div [formGroup]="your">
<ng-moment-timezone-picker [formControlName]="'yourControlName'">
</ng-moment-timezone-picker>
</div>

Step 4: Include package theme

In component *.scss or *.sass import theme

@import "~node_modules/moment-timezone-picker/assets/moment-timezone-picker.theme";

Or write own styles :)

Step 5: Configuration

Inputs

InputTypeDefaultRequiredDescription
customPlaceholderTextstringChoose...noAllows you to localize the placeholder text.
customNotFoundTextstringNo zone foundnoAllows you to localize not found text
getUserZonebooleanfalsenoAllows you to guess user timezone. If true also emits value on init.
clearablebooleanfalsenoSets that if select can be clearable.
virtualScrollbooleantruenoSets select to use virtual scroll.
disabledbooleanfalsenoDisables the ng-select component
configobject[Object object]noSee interface SelectConfig
valueTransformFNfunctionundefinednoSee valueTransformFN Type

Object: TZone

FieldTypeExample
abbrstringGMT
groupstringEurope
nameValuestringEurope/London
timeValuestring+00:00
namestringEurope/London (+00:00)

Object: SelectConfig

Default value

config: SelectConfig = {
  hideSelected: false,
  dropdownPosition: 'auto',
  appearance: 'underline',
  clearOnBackspace: true,
  closeOnSelect: true,
  appendTo: null
};

For more info read this topic.

❗NOTE: only some properties will be configurable

valueTransformFN Type

valueTransformFN: (obj: TZone | null) => any;

❗Please note that for backward support we need to pass nameValue, because this field is the most specific to find timezone.

Contributor

9.0.0

3 months ago

6.0.0

12 months ago

7.0.0

12 months ago

7.0.1

11 months ago

8.0.0

9 months ago

5.1.0

1 year ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

3.0.0

3 years ago

4.0.0

3 years ago

2.2.0

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago