@@ -28,7 +28,8 @@ export class TimeEntriesComponent implements OnInit, OnDestroy {
28
28
canMarkEntryAsWIP = true ;
29
29
timeEntriesDataSource$ : Observable < DataSource < Entry > > ;
30
30
selectedYearAsText : string ;
31
- selectedMonthIndex : number ;
31
+ selectedMonth : number ;
32
+ selectedYear : number ;
32
33
selectedMonthAsText : string ;
33
34
34
35
constructor ( private store : Store < EntryState > , private toastrService : ToastrService , private actionsSubject$ : ActionsSubject ) {
@@ -40,7 +41,6 @@ export class TimeEntriesComponent implements OnInit, OnDestroy {
40
41
}
41
42
42
43
ngOnInit ( ) : void {
43
- this . store . dispatch ( new entryActions . LoadEntries ( new Date ( ) . getMonth ( ) + 1 , new Date ( ) . getFullYear ( ) ) ) ;
44
44
this . loadActiveEntry ( ) ;
45
45
46
46
this . entriesSubscription = this . actionsSubject$ . pipe (
@@ -52,7 +52,7 @@ export class TimeEntriesComponent implements OnInit, OnDestroy {
52
52
)
53
53
) . subscribe ( ( action ) => {
54
54
this . loadActiveEntry ( ) ;
55
- this . store . dispatch ( new entryActions . LoadEntries ( this . selectedMonthIndex , new Date ( ) . getFullYear ( ) ) ) ;
55
+ this . store . dispatch ( new entryActions . LoadEntries ( this . selectedMonth , this . selectedYear ) ) ;
56
56
} ) ;
57
57
}
58
58
@@ -166,10 +166,11 @@ export class TimeEntriesComponent implements OnInit, OnDestroy {
166
166
}
167
167
168
168
dateSelected ( event : { monthIndex : number ; year : number } ) {
169
+ this . selectedYear = event . year ;
169
170
this . selectedYearAsText = event . year . toString ( ) ;
170
- this . selectedMonthIndex = event . monthIndex + 1 ;
171
+ this . selectedMonth = event . monthIndex + 1 ;
171
172
this . selectedMonthAsText = moment ( ) . month ( event . monthIndex ) . format ( 'MMMM' ) ;
172
- this . store . dispatch ( new entryActions . LoadEntries ( this . selectedMonthIndex , event . year ) ) ;
173
+ this . store . dispatch ( new entryActions . LoadEntries ( this . selectedMonth , this . selectedYear ) ) ;
173
174
}
174
175
175
176
openModal ( item : any ) {
0 commit comments