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

Commit 00069dc

Browse files
author
Dung Nguyen Tien
committed
must get hour & minute because 2-way binding does not work with range input in IE <= 11
1 parent 9791670 commit 00069dc

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/datetime-picker.component.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ declare var moment: any;
109109
<label class="hourLabel">{{locale.hour}}:</label>
110110
<input #hours class="hourInput"
111111
tabindex="90000"
112-
(change)="selectDateTime()"
112+
(change)="selectTime(hours.value, minutes.value)"
113113
type="range"
114114
min="{{minHour || 0}}"
115115
max="{{maxHour || 23}}"
@@ -120,7 +120,7 @@ declare var moment: any;
120120
<input #minutes class="minutesInput"
121121
tabindex="90000"
122122
step="{{minuteStep}}"
123-
(change)="selectDateTime()"
123+
(change)="selectTime(hours.value, minutes.value)"
124124
type="range" min="0" max="59" range="10" [(ngModel)]="minute"/>
125125
</div>
126126
</div>
@@ -504,6 +504,18 @@ export class NguiDatetimePickerComponent {
504504
this.selectDateTime();
505505
}
506506

507+
/**
508+
* set the hour and minute
509+
* @param hour {string}
510+
* @param minute {string}
511+
*/
512+
public selectTime (hour, minute) {
513+
//NOTE: must get hour & minute because 2-way binding does not work with range input in IE <= 11
514+
this.hour = parseInt(hour, 10) || 0;
515+
this.minute = parseInt(minute, 10) || 0;
516+
this.selectDateTime();
517+
}
518+
507519
/**
508520
* set the selected date and close it when closeOnSelect is true
509521
* @param date {Date}

0 commit comments

Comments
 (0)