1.0.2 • Published 4 years ago

loconox-datetimepicker v1.0.2

Weekly downloads
51
License
-
Repository
github
Last release
4 years ago

Loconox DateTime Picker

Overview

Loconox DateTime Picker is an angular 2 component for date and time picking. It has localizing feature with moment.js lib.

It is based on cuppalabs datetime picker.

Installation

  • The LoconoxDatetimePicker package is published on the npm Registry.
  • Install the package with npm:
	npm install loconox-datetimepicker

Usage

Import Angular2Datetimepicker2Module into your AppModule

import {LoconoxDatetimePickerModule} from 'loconox-datetimepicker';

@NgModule({
  // ...
  imports: [
    LoconoxDatetimePickerModule,
  ]
  // ...
})

Declare the component data variables and options in your component where you want to consume the dropdown component.

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

export class AppComponent implements OnInit {
    
	settings = {
		bigBanner: true,
		timePicker: false,
		defaultOpen: true
	}
}

Add the following component tag in the template where your want to place the datepicker

  <input [loconoxDatetimePicker]="picker" (click)="picker.open($event)">
  <loconox-datetimepicker #picker [settings]="settings"></loconox-datetimepicker>

Settings

Following settings object properties can be used to configure the component.

PropertyTypeDefaultDescription
bigBannerBooleantrueThe banner section to show the date details.
defaultOpenBooleanfalseTo open the datepicker popover on load. Default is set to false.
timePickerBooleanfalseEnable time picker feature.
closeOnSelectBooleantrueto close the popover on date select or on click of done button.
localestringenThe locale in which date will be displayed
hour24booleanfalseHour in 24h mode

Callback Methods

  • dateChange

Define a callback method to be called on date change. $event is a LoconoxDatepickerInputEvent.

  <input [loconoxDatetimePicker]="picker" (click)="picker.open($event)" (dateChange)="onDateChange($event)">
  <loconox-datetimepicker #picker [settings]="settings"></loconox-datetimepicker>
  • dateInput

Define a callback method to be called on select of the date. $event is a LoconoxDatepickerInputEvent.

  <input [loconoxDatetimePicker]="picker" (click)="picker.open($event)" (dateInput)="onDateInput($event)">
  <loconox-datetimepicker #picker [settings]="settings"></loconox-datetimepicker>
  • opened

Define a callback method to be called on the open of the calendar.

  <input [loconoxDatetimePicker]="picker" (click)="picker.open($event)">
  <loconox-datetimepicker #picker [settings]="settings" (opened)="onOpen($event)"></loconox-datetimepicker>
  • closed

Define a callback method to be called on the close of the calendar.

  <input [loconoxDatetimePicker]="picker" (click)="picker.open($event)">
  <loconox-datetimepicker #picker [settings]="settings" (closed)="onClose($event)"></loconox-datetimepicker>

Date Formats Support

format string is based on the formats supported by moment.js. See moment.js documentation.

Run examples

To run example, see Development server section

Development

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

License

MIT License.

Credits

Thanks to Pradeep Kumar Terli, Font Awesome and Moment.js for the libraries.

Author

Jérémie Libeau

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.3.1

4 years ago

0.3.0

5 years ago

0.2.2

5 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago