
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
angular2-datetimepicker
Advanced tools
Angular 2 DateTimepicker is a cool responsive DateTimepicker component for Web and Mobile. It is Mobile friendly and light weight. Developed by Cuppa Labs.
To get started with using the multiselect dropdown component, follow the below steps. It’s easy to integrate and just a matter of minutes.
npm install angular2-datetimepicker
Import AngularDateTimePickerModule
into your AppModule
import { AngularDateTimePickerModule } from 'angular2-datetimepicker';
@NgModule({
// ...
imports: [
AngularDateTimePickerModule,
]
// ...
})
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 {
date: Date = new Date();
settings = {
bigBanner: true,
timePicker: false,
format: 'dd-MM-yyyy',
defaultOpen: true
}
constructor(){}
ngOnInit(){
}
}
Add the following component tag in the template where your want to place the datepicker
<angular2-date-picker [(ngModel)]="date" [settings]="settings"></angular2-date-picker>
Following settings
object properties can be used to configure the component.
Property | Type | Default | Description |
---|---|---|---|
format | String | dd-MMM-yyyy hh:mm a | Date format of the selected date. |
bigBanner | Boolean | true | The banner section to show the date details. |
defaultOpen | Boolean | false | To open the datepicker popover on load. Default is set to false. |
timePicker | Boolean | false | Enable time picker feature. |
closeOnSelect | Boolean | true | to close the popover on date select or on click of done button. |
onDateSelect
Define a callback method to be called on select of the date.
<angular2-date-picker (onDateSelect)="onDateSelect($event)"
[(ngModel)]="date"
[settings]="settings" >
</angular2-date-picker>
format string can be composed of the following elements:
format string can also be one of the following predefined localizable formats:
'medium': equivalent to 'MMM d, y h:mm:ss a' for en_US locale (e.g. Sep 3, 2010 12:05:08 PM)
'short': equivalent to 'M/d/yy h:mm a' for en_US locale (e.g. 9/3/10 12:05 PM)
'fullDate': equivalent to 'EEEE, MMMM d, y' for en_US locale (e.g. Friday, September 3, 2010)
'longDate': equivalent to 'MMMM d, y' for en_US locale (e.g. September 3, 2010)
'mediumDate': equivalent to 'MMM d, y' for en_US locale (e.g. Sep 3, 2010)
'shortDate': equivalent to 'M/d/yy' for en_US locale (e.g. 9/3/10)
'mediumTime': equivalent to 'h:mm:ss a' for en_US locale (e.g. 12:05:08 PM)
'shortTime': equivalent to 'h:mm a' for en_US locale (e.g. 12:05 PM)
npm install
ng serve
for a dev serverhttp://localhost:4200/
MIT License.
Thanks to Font Awesome and Moment.js for the libraries.
Pradeep Kumar Terli
FAQs
Angular 2 or 4 datetime picker component
The npm package angular2-datetimepicker receives a total of 570 weekly downloads. As such, angular2-datetimepicker popularity was classified as not popular.
We found that angular2-datetimepicker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.