@@ -23,7 +23,7 @@ declare var moment: any;
23
23
selector : 'ng2-datetime-picker' ,
24
24
template : `
25
25
<div class="ng2-datetime-picker">
26
- <div class="close-button" *ngIf="showCloseButton" (click)="close()">X </div>
26
+ <div class="close-button" *ngIf="showCloseButton" (click)="close()"></div>
27
27
28
28
<!-- Month - Year -->
29
29
<div class="month" *ngIf="!timeOnly">
@@ -82,6 +82,7 @@ declare var moment: any;
82
82
83
83
<!-- Time -->
84
84
<div class="time" id="time" *ngIf="!dateOnly">
85
+ <div class="select-current-time" (click)="selectCurrentTime()"></div>
85
86
<label class="timeLabel">Time:</label>
86
87
<span class="timeValue">
87
88
{{("0"+hour).slice(-2)}} : {{("0"+minute).slice(-2)}}
@@ -128,7 +129,8 @@ declare var moment: any;
128
129
animation: slideDown 0.1s ease-in-out;
129
130
animation-fill-mode: both;
130
131
}
131
- .ng2-datetime-picker .close-button {
132
+ .ng2-datetime-picker .close-button:before {
133
+ content: 'X';
132
134
position: absolute;
133
135
padding: 0 5px;
134
136
cursor: pointer;
@@ -212,6 +214,18 @@ declare var moment: any;
212
214
clear: left;
213
215
height: 0;
214
216
}
217
+ .ng2-datetime-picker .time {
218
+ position: relative;
219
+ }
220
+ .ng2-datetime-picker .select-current-time:before {
221
+ content: 'current time';
222
+ position: absolute;
223
+ top: 1em;
224
+ right: 5px;
225
+ z-index: 1;
226
+ cursor: pointer;
227
+ color: #0000ff;
228
+ }
215
229
.ng2-datetime-picker .hourLabel,
216
230
.ng2-datetime-picker .minutesLabel {
217
231
display: inline-block;
@@ -329,6 +343,12 @@ export class Ng2DatetimePickerComponent {
329
343
return new Date ( date . getFullYear ( ) , date . getMonth ( ) , date . getDate ( ) , 0 , 0 , 0 , 0 ) ;
330
344
}
331
345
346
+ public selectCurrentTime ( ) {
347
+ this . hour = ( new Date ( ) ) . getHours ( ) ;
348
+ this . minute = ( new Date ( ) ) . getMinutes ( ) ;
349
+ this . selectDateTime ( ) ;
350
+ }
351
+
332
352
/**
333
353
* set the selected date and close it when closeOnSelect is true
334
354
* @param date {Date}
0 commit comments