Skip to content

Commit d24023f

Browse files
committed
datetimepicker component initial commit
0 parents commit d24023f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+81615
-0
lines changed

.angular-cli.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"project": {
4+
"name": "angular2-datetimepicker"
5+
},
6+
"apps": [
7+
{
8+
"root": "src",
9+
"outDir": "docs",
10+
"assets": [
11+
"assets",
12+
"favicon.ico"
13+
],
14+
"index": "index.html",
15+
"main": "main.ts",
16+
"polyfills": "polyfills.ts",
17+
"test": "test.ts",
18+
"tsconfig": "tsconfig.app.json",
19+
"testTsconfig": "tsconfig.spec.json",
20+
"prefix": "app",
21+
"styles": [
22+
"styles.css","../node_modules/font-awesome/css/font-awesome.min.css","../node_modules/bootstrap/dist/css/bootstrap.min.css"
23+
],
24+
"scripts": [],
25+
"environmentSource": "environments/environment.ts",
26+
"environments": {
27+
"dev": "environments/environment.ts",
28+
"prod": "environments/environment.prod.ts"
29+
}
30+
}
31+
],
32+
"e2e": {
33+
"protractor": {
34+
"config": "./protractor.conf.js"
35+
}
36+
},
37+
"lint": [
38+
{
39+
"project": "src/tsconfig.app.json"
40+
},
41+
{
42+
"project": "src/tsconfig.spec.json"
43+
},
44+
{
45+
"project": "e2e/tsconfig.e2e.json"
46+
}
47+
],
48+
"test": {
49+
"karma": {
50+
"config": "./karma.conf.js"
51+
}
52+
},
53+
"defaults": {
54+
"styleExt": "css",
55+
"component": {}
56+
}
57+
}

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Editor configuration, see http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
max_line_length = off
13+
trim_trailing_whitespace = false

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
8+
# dependencies
9+
/node_modules
10+
11+
# IDEs and editors
12+
/.idea
13+
.project
14+
.classpath
15+
.c9/
16+
*.launch
17+
.settings/
18+
*.sublime-workspace
19+
20+
# IDE - VSCode
21+
.vscode/*
22+
!.vscode/settings.json
23+
!.vscode/tasks.json
24+
!.vscode/launch.json
25+
!.vscode/extensions.json
26+
27+
# misc
28+
/.sass-cache
29+
/connect.lock
30+
/coverage
31+
/libpeerconnection.log
32+
npm-debug.log
33+
testem.log
34+
/typings
35+
36+
# e2e
37+
/e2e/*.js
38+
/e2e/*.map
39+
40+
# System Files
41+
.DS_Store
42+
Thumbs.db

README.md

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
2+
# Angular 2 / 4 DateTime Picker
3+
4+
# [Documentation](http://cuppalabs.github.io/components/datepicker) | [Demos / Examples](https://cuppalabs.github.io/angular2-datetimepicker).
5+
6+
### Overview
7+
8+
Angular 2 DateTimepicker is a cool responsive DateTimepicker component for Web and Mobile. It is Mobile friendly and light weight. Developed by [Cuppa Labs](http://www.cuppalabs.com).
9+
10+
### Getting Started
11+
To get started with using the multiselect dropdown component, follow the below steps. It’s easy to integrate and just a matter of minutes.
12+
13+
### Installation
14+
- The datetimepicker package is published on the [npm](https://www.npmjs.com/package/angular2-datetimepicker) Registry.
15+
- Install the package with [npm](https://www.npmjs.com):
16+
17+
```js
18+
npm install angular2-datetimepicker
19+
```
20+
21+
### Usage
22+
23+
Import `AngularDateTimePickerModule` into your `AppModule`
24+
25+
```js
26+
import { AngularDateTimePickerModule } from 'angular2-datetimepicker';
27+
28+
@NgModule({
29+
// ...
30+
imports: [
31+
AngularDateTimePickerModule,
32+
]
33+
// ...
34+
})
35+
36+
```
37+
Declare the component data variables and options in your component where you want to consume the dropdown component.
38+
39+
```js
40+
import { Component, OnInit } from '@angular/core';
41+
42+
export class AppComponent implements OnInit {
43+
44+
date: Date = new Date();
45+
settings = {
46+
bigBanner: true,
47+
timePicker: false,
48+
format: 'dd-MM-yyyy',
49+
defaultOpen: true
50+
}
51+
constructor(){}
52+
ngOnInit(){
53+
54+
}
55+
}
56+
57+
```
58+
59+
Add the following component tag in the template where your want to place the datepicker
60+
61+
```html
62+
63+
<angular2-date-picker [(ngModel)]="date" [settings]="settings"></angular2-date-picker>
64+
65+
```
66+
67+
68+
### Settings
69+
70+
Following `settings` object properties can be used to configure the component.
71+
72+
|Property|Type|Default|Description|
73+
|:--- |:--- |:--- |:--- |
74+
|format|String|dd-MMM-yyyy hh:mm a|Date format of the selected date.|
75+
|bigBanner|Boolean|true| The banner section to show the date details. |
76+
|defaultOpen|Boolean|false|To open the datepicker popover on load. Default is set to false.|
77+
|timePicker|Boolean|false|Enable time picker feature.|
78+
|closeOnSelect|Boolean|true|to close the popover on date select or on click of done button.|
79+
80+
81+
## Callback Methods
82+
83+
- `onDateSelect`
84+
85+
Define a callback method to be called on select of the date.
86+
87+
```html
88+
89+
<angular2-date-picker (onDateSelect)="onDateSelect($event)"
90+
[(ngModel)]="date"
91+
[settings]="settings" >
92+
</angular2-date-picker>
93+
94+
```
95+
## Date Formats Support
96+
97+
format string can be composed of the following elements:
98+
99+
- 'yyyy': 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)
100+
- 'yy': 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
101+
- 'y': 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)
102+
- 'MMMM': Month in year (January-December)
103+
- 'MMM': Month in year (Jan-Dec)
104+
- 'MM': Month in year, padded (01-12)
105+
- 'M': Month in year (1-12)
106+
- 'LLLL': Stand-alone month in year (January-December)
107+
- 'dd': Day in month, padded (01-31)
108+
- 'd': Day in month (1-31)
109+
- 'EEEE': Day in Week,(Sunday-Saturday)
110+
- 'EEE': Day in Week, (Sun-Sat)
111+
- 'HH': Hour in day, padded (00-23)
112+
- 'H': Hour in day (0-23)
113+
- 'hh': Hour in AM/PM, padded (01-12)
114+
- 'h': Hour in AM/PM, (1-12)
115+
- 'mm': Minute in hour, padded (00-59)
116+
- 'm': Minute in hour (0-59)
117+
- 'ss': Second in minute, padded (00-59)
118+
- 's': Second in minute (0-59)
119+
- 'sss': Millisecond in second, padded (000-999)
120+
- 'a': AM/PM marker
121+
- 'Z': 4 digit (+sign) representation of the timezone offset (-1200-+1200)
122+
- 'ww': Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year
123+
- 'w': Week of year (0-53). Week 1 is the week with the first Thursday of the year
124+
- 'G', 'GG', 'GGG': The abbreviated form of the era string (e.g. 'AD')
125+
- 'GGGG': The long form of the era string (e.g. 'Anno Domini')
126+
127+
format string can also be one of the following predefined localizable formats:
128+
129+
- 'medium': equivalent to 'MMM d, y h:mm:ss a' for en_US locale (e.g. Sep 3, 2010 12:05:08 PM)
130+
131+
- 'short': equivalent to 'M/d/yy h:mm a' for en_US locale (e.g. 9/3/10 12:05 PM)
132+
- 'fullDate': equivalent to 'EEEE, MMMM d, y' for en_US locale (e.g. Friday, September 3, 2010)
133+
- 'longDate': equivalent to 'MMMM d, y' for en_US locale (e.g. September 3, 2010)
134+
- 'mediumDate': equivalent to 'MMM d, y' for en_US locale (e.g. Sep 3, 2010)
135+
- 'shortDate': equivalent to 'M/d/yy' for en_US locale (e.g. 9/3/10)
136+
- 'mediumTime': equivalent to 'h:mm:ss a' for en_US locale (e.g. 12:05:08 PM)
137+
- 'shortTime': equivalent to 'h:mm a' for en_US locale (e.g. 12:05 PM)
138+
139+
## Run locally
140+
- Clone the repository or downlod the .zip,.tar files.
141+
- Run `npm install`
142+
- Run `ng serve` for a dev server
143+
- Navigate to `http://localhost:4200/`
144+
145+
## License
146+
MIT License.
147+
148+
## Credits
149+
Thanks to Font Awesome and Moment.js for the libraries.
150+
151+
## Author
152+
Pradeep Kumar Terli

docs/assets/images/coffee11.png

12.7 KB
Loading

docs/assets/images/coffee14.png

2.75 KB
Loading
7.09 KB
Loading
9.69 KB
Loading

docs/favicon.ico

5.3 KB
Binary file not shown.
162 KB
Binary file not shown.

0 commit comments

Comments
 (0)