@@ -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()"></div>
@@ -256,6 +260,17 @@ declare var moment: any;
256
260
background: rgba(0,0,0,0);
257
261
}
258
262
263
+ .ng2-datetime-picker .shortcuts {
264
+ padding: 10px;
265
+ text-align: center;
266
+ }
267
+
268
+ .ng2-datetime-picker .shortcuts a {
269
+ font-family: Sans-serif;
270
+ margin: 0 0.5em;
271
+ text-decoration: none;
272
+ }
273
+
259
274
@media (max-width: 767px) {
260
275
.ng2-datetime-picker {
261
276
position: fixed;
@@ -299,6 +314,7 @@ export class Ng2DatetimePickerComponent {
299
314
@Input ( 'disabled-dates' ) disabledDates : Date [ ] ;
300
315
@Input ( 'show-close-button' ) showCloseButton : boolean ;
301
316
@Input ( 'show-close-layer' ) showCloseLayer : boolean ;
317
+ @Input ( 'show-today-shortcut' ) showTodayShortcut : boolean = false ;
302
318
303
319
@Output ( 'selected$' ) selected$ :EventEmitter < any > = new EventEmitter ( ) ;
304
320
@Output ( 'closing$' ) closing$ :EventEmitter < any > = new EventEmitter ( ) ;
@@ -455,4 +471,8 @@ export class Ng2DatetimePickerComponent {
455
471
public close ( ) {
456
472
this . closing$ . emit ( true ) ;
457
473
}
474
+
475
+ public selectToday ( ) {
476
+ this . selectDateTime ( new Date ( ) ) ;
477
+ }
458
478
}
0 commit comments