![MIT License](https://camo.githubusercontent.com/95c10fa6088c05deb9bdfe215245185f6f8262c17e68b55188cfcf7c3ce03c52/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c6174)
A configurable and selectable range dates calendar component for ionic2
if you do not use moment
$ npm install moment --save
$ npm install ion2-calendar --save
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 {}
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
![date](https://github.com/HsuanXyz/hsuan.github.io/raw/master/assets/ion2-calendar/%E5%8D%95%E9%80%89%E6%97%A5%E6%9C%9F.gif?raw=true&raw=true)
![date range](https://github.com/HsuanXyz/hsuan.github.io/raw/master/assets/ion2-calendar/%E5%A4%9A%E9%80%89%E6%97%A5%E6%9C%9F.gif?raw=true&raw=true)
![disable weekdays](https://github.com/HsuanXyz/hsuan.github.io/raw/master/assets/ion2-calendar/%E7%A6%81%E7%94%A8%E6%98%9F%E6%9C%9F.gif?raw=true&raw=true)
![weekdays title](https://github.com/HsuanXyz/hsuan.github.io/raw/master/assets/ion2-calendar/%E8%87%AA%E5%AE%9A%E4%B9%89%E5%91%A8%E6%A0%87%E9%A2%98.gif?raw=true&raw=true)
![month title](https://github.com/HsuanXyz/hsuan.github.io/raw/master/assets/ion2-calendar/%E8%87%AA%E5%AE%9A%E4%B9%89%E6%9C%88%E4%BB%BD%E6%A0%87%E9%A2%98.gif?raw=true&raw=true)
![days config](https://github.com/HsuanXyz/hsuan.github.io/raw/master/assets/ion2-calendar/%E8%87%AA%E5%AE%9A%E4%B9%89%E5%A4%A9.gif?raw=true&raw=true)
openCalendar(Options,ModalOptions)
Name |
Type |
Default |
Description |
from |
Date |
new Date() |
start date |
to |
Date |
0 (Infinite) |
end date |
title |
string |
'Calendar' |
title |
isRadio |
boolean |
true |
true for one day ,false for range dates |
disableWeekdays |
Array |
[] |
week to be disabled (0-6) |
closeLabel |
string |
cancel |
cancel button label ,can be an empty string |
monthTitle |
string |
'MMM yyyy' |
month title format |
weekdaysTitle |
Array |
"Di_Lu_Ma_Me_Je_Ve_Sa".split("_") |
weeks title |
daysConfig |
Array<DaysConfig> |
[] |
days configuration |
Name |
Type |
Default |
Description |
date |
Date |
required |
configured days |
marked |
boolean |
false |
highlight color |
disable |
boolean |
false |
disable |
title |
string |
none |
displayed title example:'today' |
subTitle |
string |
none |
subTitle subTitle example:'christmas' |
Name |
Type |
Default |
Description |
showBackdrop |
boolean |
true |
Whether to show the backdrop |
enableBackdropDismiss |
boolean |
true |
Whether the popover should be dismissed by tapping the backdrop |
Name |
Type |
Description |
from |
Day |
start date If isRadio it is false |
to |
Day |
end date If isRadio it is false |
date |
Day |
date If isRadio it is true |
Name |
Type |
Description |
time |
number |
timestamp |
marked |
boolean |
highlight color |
disable |
boolean |
disable |
title |
string |
displayed title |
subTitle |
string |
subTitle subTitle |
- Add style settings.
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