1.0.4 • Published 7 years ago

hpb-datepicker v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

HPB Datepicker - An angular datepicker

N|Solid

Requirements

Animations requiere Gsap

<script src="//cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/TweenMax.min.js"></script>   

Also momentjs is necesary

"dependencies": {
    ...
    "moment": "^2.18.1",
    ...
  },

Installation

$ npm install hpb-datepicker --save

Usage

Import in your module

import { HsdpComponent } from 'hpb-datepicker/hsdp.component';

@NgModule({
    declarations: [
        ...
        HsdpComponent,
        ...
    ],
    ...
})

Use as a directive

<h-hsdp (outputEvents)="selectDatePicker($event)"
        [options]="dpOptions" 
        [showYearPicker]="true" 
        [position]="'top'"
        [mainColor]="'#D0A368'"></h-hsdp>

Inputs

InputDefaultTypeRequired
inputEvents-eventno
options-DatePickerOptions classno
mainColor#6AB7FCstringno
positiondefaultstringno
showYearPickerfalsebooleanno

DatePickerOptions Class (hsdp.component.ts line 51)

export class DatePickerOptions {
    autoApply?: boolean;
    style?: 'normal' | 'big' | 'bold';
    locale?: string;
    minDate?: Date;
    maxDate?: Date;
    initialDate?: Date | string;
    firstWeekdaySunday?: boolean;
    format?: string;

    constructor(obj?: IDatePickerOptions) {
        this.autoApply = (obj && obj.autoApply === true) ? true : false;
        this.style = obj && obj.style ? obj.style : 'normal';
        this.locale = obj && obj.locale ? obj.locale : 'es';
        this.minDate = obj && obj.minDate ? obj.minDate : null;
        this.maxDate = obj && obj.maxDate ? obj.maxDate : null;
        this.initialDate = obj && obj.initialDate ? obj.initialDate : null;
        this.firstWeekdaySunday = obj && obj.firstWeekdaySunday ? obj.firstWeekdaySunday : false;
        this.format = obj && obj.format ? obj.format : 'DD [de] MMMM';
        
    }
}

Outputs

InputDefaultTypeRequired
outputEvents-eventno

Credits

This is an adaptation of this awesome datepicker

License

MIT