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

ion2-calendar

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ion2-calendar

A date picker for ionic2

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ion2-calendar

Dependency Status NPM version Downloads MIT License

A configurable and selectable range dates calendar component for ionic2

中文文档

install

if you do not use moment $ npm install moment --save

$ npm install ion2-calendar --save

import module

import { NgModule, ErrorHandler } from '@angular/core';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
...
import { CalendarModule } from "ion2-calendar";

@NgModule({
  declarations: [
    MyApp,
    ...
  ],
  imports: [
    IonicModule.forRoot(MyApp),
    CalendarModule
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    ...
  ],
  providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}]
})
export class AppModule {}

Use

import { Component } from '@angular/core';

import {CalendarController} from "ion2-calendar/dist";

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  constructor(
    public calendarCtrl: CalendarController
  ) {

  }

  openCalendar(){
    this.calendarCtrl.openCalendar({
      from:new Date()
    })
    .then( res => { console.log(res) } );
  }

}

Demo

DEMO

date

date

date range

date range

disable weekdays

disable weekdays

weekdays title

weekdays title

month title

month title

days config

days config

API

openCalendar(Options,ModalOptions)

Options

NameTypeDefaultDescription
fromDatenew Date()start date
toDate0 (Infinite)end date
titlestring'Calendar'title
cssClassstring''Additional classes for custom styles, separated by spaces.
isRadiobooleantruetrue for one day ,false for range dates
disableWeekdaysArray[]week to be disabled (0-6)
closeLabelstringcancelcancel button label ,can be an empty string
monthTitlestring'MMM yyyy'month title format
weekdaysTitleArray"Di_Lu_Ma_Me_Je_Ve_Sa".split("_")weeks title
daysConfigArray<DaysConfig>[]days configuration
DaysConfig
NameTypeDefaultDescription
dateDaterequiredconfigured days
markedbooleanfalsehighlight color
disablebooleanfalsedisable
titlestringnonedisplayed title example:'today'
subTitlestringnonesubTitle subTitle example:'christmas'

ModalOptions

NameTypeDefaultDescription
showBackdropbooleantrueWhether to show the backdrop
enableBackdropDismissbooleantrueWhether the popover should be dismissed by tapping the backdrop

Output Promise

NameTypeDescription
fromDaystart date If isRadio it is false
toDayend date If isRadio it is false
dateDaydate If isRadio it is true

Day

NameTypeDescription
timenumbertimestamp
markedbooleanhighlight color
disablebooleandisable
titlestringdisplayed title
subTitlestringsubTitle subTitle

TODO

  1. Add style settings.

Environment

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 1.1.3

Keywords

FAQs

Package last updated on 10 Mar 2017

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