Skip to content
This repository was archived by the owner on Mar 2, 2018. It is now read-only.

Commit c87a759

Browse files
committed
2 parents 6f7c1c5 + a6f2fbd commit c87a759

25 files changed

+542
-252
lines changed

ISSUE_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ _Please be specific with an example. An issue with no example or unclear require
44
**Steps to reproduce and a minimal demo**
55

66
- _What steps should we try in your demo to see the problem?_
7-
- _Plunker example_
8-
- _If you cannot reproduce an issue with a plunker example, it's your environmental issue_
7+
- _Plunker example(required), MCVE(Minimal/Complete/Verifable Example)_
8+
- _If you cannot reproduce an issue with a plunker example, it may be your environmental issue_
99

1010
**Current behavior**
1111

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ AngularJS 2 DateTime Picker
7171
day="31"
7272
hour="23"
7373
minute='59'
74-
close-on-select="false" />
74+
[close-on-select]="false" />
7575

7676
For full example, please check `test` directory to see the example of;
7777

@@ -139,6 +139,7 @@ is the list of variables that you can override.
139139
* **months**: default: January, February
140140
* **formatDate**: default: returns YYYY-MM-DD HH:MM
141141
* **parseDate**: default: returns date from YYYY-MM-DD HH:MM
142+
* **locale**: default: 'date', 'year', 'month', time', 'hour', 'minute'
142143

143144
## **ng2-ui** welcomes new members and contributors
144145

app/build/app.js

Lines changed: 98 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build/app.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/directive-test.component.ts

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ var templateStr = `
2222
[show-close-layer]="true"
2323
date-only="true"/>
2424
date2: {{date2}}
25+
<button id="set-date" (click)="date2 = date2New">Set 2017-12-31</button>
2526
</ng2-utils-2>
2627
<pre>{{templateStr | htmlCode:'ng2-utils-2'}}</pre>
2728
</fieldset>
@@ -33,7 +34,8 @@ var templateStr = `
3334
date-format="DD-MM-YYYY hh:mm"
3435
time-only="true"
3536
minute-step="5"
36-
close-on-select="false" />
37+
(popupClosed)="onDatetimePickerClosed()"
38+
[close-on-select]="false" />
3739
</ng2-utils-4>
3840
<pre>{{templateStr | htmlCode:'ng2-utils-4'}}</pre>
3941
</fieldset>
@@ -57,7 +59,7 @@ var templateStr = `
5759
required
5860
formControlName="date"
5961
ng2-datetime-picker
60-
close-on-select="false"/>
62+
[close-on-select]="false"/>
6163
</form>
6264
myForm.controls.date.value: {{myForm.controls.date.value}}
6365
<br/>myForm.value: {{myForm.value | json}}
@@ -79,7 +81,21 @@ var templateStr = `
7981
</ng2-utils-3>
8082
<pre>{{templateStr | htmlCode:'ng2-utils-3'}}</pre>
8183
</fieldset>
82-
84+
85+
<fieldset id="test6">
86+
<legend><h2>Material Design</h2></legend>
87+
<ng2-utils-4>
88+
<md-input-container>
89+
<input mdInput
90+
[(ngModel)]="mdDate"
91+
name="mdDate"
92+
ng2-datetime-picker
93+
date-only="true"
94+
[close-on-select]="false" />
95+
</md-input-container>
96+
</ng2-utils-4>
97+
</fieldset>
98+
8399
</div>
84100
`;
85101

@@ -99,13 +115,12 @@ export class DirectiveTestComponent {
99115
templateStr: string = templateStr;
100116

101117
myForm: FormGroup; // our form model
102-
date1 = null;
103-
date1DefaultValue = new Date(2014, 11, 31, 21, 45, 59);
104118

105119
date2 = new Date(2017, 0, 28);
106120
date2DisabledDates = [new Date(2017, 0, 10), new Date(2017, 0, 20)];
107121
date2MinDate = new Date(2017, 0, 1);
108122
date2MaxDate = new Date(2017, 11, 31);
123+
date2New = new Date(2017,11,31);
109124

110125
date3 = new Date("Thu Jan 01 2015 00:00:00 GMT-0500 (EST)");
111126

@@ -114,6 +129,8 @@ export class DirectiveTestComponent {
114129
Ng2Datetime.parseDate('2017-01-15T14:22:00-06:00', this.date4TimezoneFormat), this.date4TimezoneFormat
115130
);
116131

132+
mdDate: Date = new Date(2017, 0, 28);
133+
117134
constructor(private fb: FormBuilder) { }
118135

119136
ngOnInit() {
@@ -124,4 +141,7 @@ export class DirectiveTestComponent {
124141
//moment.tz.setDefault('US/Central'); // Set the default timezone that moment will use
125142
}
126143

144+
onDatetimePickerClosed() {
145+
console.log('datetime picker is closed');
146+
}
127147
}

app/main.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import 'core-js/es6';
33
import 'core-js/es7/reflect';
44
import 'zone.js/dist/zone';
5+
import 'hammerjs';
56

67
// The browser platform with a compiler
78
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
@@ -10,6 +11,7 @@ import { NgModule } from '@angular/core';
1011
import { BrowserModule } from '@angular/platform-browser';
1112
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
1213
import { LocationStrategy, HashLocationStrategy } from "@angular/common";
14+
import { MaterialModule } from '@angular/material';
1315

1416
import { AppComponent } from './app.component';
1517

@@ -20,7 +22,15 @@ import { Ng2UtilsModule } from 'ng2-utils';
2022
import { APP_ROUTER_PROVIDERS, APP_ROUTER_COMPONENTS } from './app.route';
2123

2224
@NgModule({
23-
imports: [BrowserModule, APP_ROUTER_PROVIDERS, FormsModule, ReactiveFormsModule, Ng2UtilsModule, Ng2DatetimePickerModule],
25+
imports: [
26+
BrowserModule,
27+
APP_ROUTER_PROVIDERS,
28+
FormsModule,
29+
ReactiveFormsModule,
30+
Ng2UtilsModule,
31+
Ng2DatetimePickerModule,
32+
MaterialModule
33+
],
2434
declarations: [AppComponent, APP_ROUTER_COMPONENTS],
2535
providers: [
2636
{ provide: LocationStrategy, useClass: HashLocationStrategy },

dist/ng2-datetime-picker.component.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,20 @@ export declare class Ng2DatetimePickerComponent {
2020
maxHour: number;
2121
disabledDates: Date[];
2222
showCloseButton: boolean;
23+
showCloseLayer: boolean;
2324
selected$: EventEmitter<any>;
2425
closing$: EventEmitter<any>;
2526
hours: ElementRef;
2627
minutes: ElementRef;
2728
el: HTMLElement;
28-
monthData: any;
2929
disabledDatesInTime: number[];
30+
locale: any;
31+
private _monthData;
3032
constructor(elementRef: ElementRef, ng2Datetime: Ng2Datetime, cdRef: ChangeDetectorRef);
3133
year: number;
3234
month: number;
3335
day: number;
36+
readonly monthData: any;
3437
today: Date;
3538
isWeekend(dayNum: number, month?: number): boolean;
3639
ngOnInit(): void;

dist/ng2-datetime-picker.component.js

Lines changed: 18 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ng2-datetime-picker.component.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)