@@ -81,6 +81,10 @@ declare var moment: any;
81
81
</div>
82
82
</div>
83
83
84
+ <div class="shortcuts" *ngIf="showTodayShortcut">
85
+ <a href="#" (click)="selectToday()">Today</a>
86
+ </div>
87
+
84
88
<!-- Time -->
85
89
<div class="time" id="time" *ngIf="!dateOnly">
86
90
<div class="select-current-time" (click)="selectCurrentTime()">{{locale.currentTime}}</div>
@@ -261,6 +265,17 @@ declare var moment: any;
261
265
background: rgba(0,0,0,0);
262
266
}
263
267
268
+ .ng2-datetime-picker .shortcuts {
269
+ padding: 10px;
270
+ text-align: center;
271
+ }
272
+
273
+ .ng2-datetime-picker .shortcuts a {
274
+ font-family: Sans-serif;
275
+ margin: 0 0.5em;
276
+ text-decoration: none;
277
+ }
278
+
264
279
@media (max-width: 767px) {
265
280
.ng2-datetime-picker {
266
281
position: fixed;
@@ -304,6 +319,7 @@ export class Ng2DatetimePickerComponent {
304
319
@Input ( 'disabled-dates' ) disabledDates : Date [ ] ;
305
320
@Input ( 'show-close-button' ) showCloseButton : boolean ;
306
321
@Input ( 'show-close-layer' ) showCloseLayer : boolean ;
322
+ @Input ( 'show-today-shortcut' ) showTodayShortcut : boolean = false ;
307
323
308
324
@Output ( 'selected$' ) selected$ :EventEmitter < any > = new EventEmitter ( ) ;
309
325
@Output ( 'closing$' ) closing$ :EventEmitter < any > = new EventEmitter ( ) ;
@@ -458,4 +474,8 @@ export class Ng2DatetimePickerComponent {
458
474
public close ( ) {
459
475
this . closing$ . emit ( true ) ;
460
476
}
477
+
478
+ public selectToday ( ) {
479
+ this . selectDateTime ( new Date ( ) ) ;
480
+ }
461
481
}
0 commit comments