Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

moment-timezone-picker

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moment-timezone-picker

A simple angular moment timezone picker

  • 7.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6K
increased by20.58%
Maintainers
1
Weekly downloads
 
Created
Source

MomentTimezonePicker

NPM

npm version

Versions

AngularVersion
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
[customPlaceholderText]stringChoose...noAllows you to localize the placeholder text.
[customNotFoundText]stringNo zone foundnoAllows you to localize not found text
[getUserZone]booleanfalsenoAllows you to guess user timezone. If true also emits value on init.
[clearable]booleanfalsenoSets that if select can be clearable.
[virtualScroll]booleantruenoSets select to use virtual scroll.
[disabled]booleanfalsenoDisables the ng-select component
[config]object[Object object]noSee interface SelectConfig
[valueTransformFN]functionundefinednoSee 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

Keywords

FAQs

Package last updated on 02 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc