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

ultipicker

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ultipicker

A fancy datepicker for angular

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Ultipicker: moment based datepicker

NPM

npm version


Demo

Follow https://romko775.github.io/ng2-ultipicker/ to see how pickers look

Log of changes

Follow https://github.com/Romko775/ng2-ultipicker/blob/master/projects/ultipicker/LOGS.md to see changes

Getting started

Step 1: Install

NPM
npm i ultipicker --save

Step 2: Import the UltipickerModule

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { UltipickerModule } from 'ultipicker'; //add this

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    UltipickerModule //add this
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Step 3: Add in component html picker

Dual picker

<ng2-ultipicker-dual [defaultStartDate]="yourDefaultStartDate"
                     [defaultEndDate]="yourDefaultEndDate">
</ng2-ultipicker-dual>
Inputs
InputTypeDefaultRequiredDescription
minStartDatemoment.MomentnullnoThe minimal start date that user can select
maxEndDatemoment.MomentnullnoThe maximal end date that user can select
defaultStartDatemoment.Momentmoment()noThe date of start date picker
defaultEndDatemoment.Momentmoment()noThe date of end date picker
inputDayFormatstringMM-DD-YYYYnoThe date format in which moment time transforms
separatorstring' - 'noThe separator for readonly input between dates
dayNamesArray['Su', ... 'St']noCan set local day names. Order only when first day is Sunday. Auto shifts to Monday if isoWeekConfig = 1
isoWeekConfignumber0no0 - first day Sunday. 1 - first day Monday
showCalendarWeeksbooleanfalsenoShow or hide calendar weeks numbers
monthNamesArray['January', ... 'December']noCan set local names for months
rangesArraySee rangesnoCan set predetermined ranges
ranges
@Input() ranges: Array<Range> = [
    {
      key: 'Today',
      start: moment(),
      end: moment()
    },
    {
      key: 'Yesterday',
      start: moment().subtract(1, 'days'),
      end: moment().subtract(1, 'days')
    },
    {
      key: 'This week',
      start: moment().startOf('week'),
      end: moment()
    },
    {
      key: 'This month',
      start: moment().startOf('month'),
      end: moment()
    },
    {
      key: 'This year',
      start: moment().startOf('year'),
      end: moment()
    },
    {
      key: 'Last week',
      start: moment().subtract(1, 'week').startOf('week'),
      end: moment().subtract(1, 'week').endOf('week')
    },
    {
      key: 'Last month',
      start: moment().subtract(1, 'month').startOf('month'),
      end: moment().subtract(1, 'month').endOf('month')
    },
    {
      key: 'Last year',
      start: moment().subtract(1, 'year').startOf('year'),
      end: moment().subtract(1, 'year').endOf('year')
    }
  ];
Output

Works with Reactive Forms. Just add [formControlName].

Mono picker

<ng2-ultipicker-mono   [defaultDate]="yourDefaultDate">
</ng2-ultipicker-mono>
Inputs
InputTypeDefaultRequiredDescription
minDatemoment.MomentnullnoThe minimal start date that user can select
maxDatemoment.MomentnullnoThe maximal end date that user can select
defaultDatemoment.Momentmoment()noThe default date of picker
inputDayFormatstringMM-DD-YYYYnoThe date format in which moment time transforms
dayNamesArray['Su', ... 'St']noCan set local day names. Order only when first day is Sunday. Auto shifts to Monday if isoWeekConfig = 1
isoWeekConfignumber0no0 - first day Sunday. 1 - first day Monday
showCalendarWeeksbooleanfalsenoShow or hide calendar weeks numbers
monthNamesArray['January', ... 'December']noCan set local names for months
autoClosebooleanfalsenoIf true closes the picker when user selected the date
defaultSetsArraySee defaultSetsnoCan set predetermined date sets
defaultSets
@Input() defaultSets: Array<DefaultSet> = [
    {
      key: 'Today',
      value: moment().startOf('day')
    },
    {
      key: 'Yesterday',
      value: moment().subtract(1, 'day').startOf('day')
    },
    {
      key: 'Start of week',
      value: moment().startOf('week')
    },
    {
      key: 'Start of month',
      value: moment().startOf('month')
    }
  ];
Output

Works with Reactive Forms. Just add [formControlName].

Contributor

Inspired by

Keywords

FAQs

Package last updated on 05 Mar 2019

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