@@ -28,7 +28,8 @@ export class TimeEntriesComponent implements OnInit, OnDestroy {
2828 canMarkEntryAsWIP = true ;
2929 timeEntriesDataSource$ : Observable < DataSource < Entry > > ;
3030 selectedYearAsText : string ;
31- selectedMonthIndex : number ;
31+ selectedMonth : number ;
32+ selectedYear : number ;
3233 selectedMonthAsText : string ;
3334
3435 constructor ( private store : Store < EntryState > , private toastrService : ToastrService , private actionsSubject$ : ActionsSubject ) {
@@ -40,7 +41,6 @@ export class TimeEntriesComponent implements OnInit, OnDestroy {
4041 }
4142
4243 ngOnInit ( ) : void {
43- this . store . dispatch ( new entryActions . LoadEntries ( new Date ( ) . getMonth ( ) + 1 , new Date ( ) . getFullYear ( ) ) ) ;
4444 this . loadActiveEntry ( ) ;
4545
4646 this . entriesSubscription = this . actionsSubject$ . pipe (
@@ -52,7 +52,7 @@ export class TimeEntriesComponent implements OnInit, OnDestroy {
5252 )
5353 ) . subscribe ( ( action ) => {
5454 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 ) ) ;
5656 } ) ;
5757 }
5858
@@ -166,10 +166,11 @@ export class TimeEntriesComponent implements OnInit, OnDestroy {
166166 }
167167
168168 dateSelected ( event : { monthIndex : number ; year : number } ) {
169+ this . selectedYear = event . year ;
169170 this . selectedYearAsText = event . year . toString ( ) ;
170- this . selectedMonthIndex = event . monthIndex + 1 ;
171+ this . selectedMonth = event . monthIndex + 1 ;
171172 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 ) ) ;
173174 }
174175
175176 openModal ( item : any ) {
0 commit comments