due at fix 2

This commit is contained in:
2022-01-06 21:52:17 +01:00
parent 2fc7922707
commit cb632e9e8e
3 changed files with 13 additions and 2 deletions

View File

@ -8,7 +8,7 @@
</mat-form-field>
<mat-form-field appearance="outline" id="addEntryfield">
<mat-label>Fälligkeit</mat-label>
<input matInput ngModel name="dueAt" [matDatepicker]="dueAtPicker"/>
<input matInput ngModel name="dueAt" [matDatepicker]="dueAtPicker" [formControl]="presetDueAt"/>
<mat-datepicker-toggle matSuffix [for]="dueAtPicker"></mat-datepicker-toggle>
<mat-datepicker #dueAtPicker></mat-datepicker>
</mat-form-field>

View File

@ -1,5 +1,6 @@
import { ViewFlags } from '@angular/compiler/src/core';
import { Component, Input, OnInit, OnChanges, ViewChild } from '@angular/core';
import { FormControl } from '@angular/forms';
import { MatButton } from '@angular/material/button';
import { MatExpansionPanel } from '@angular/material/expansion';
import { MatTableDataSource } from '@angular/material/table';
@ -40,7 +41,7 @@ export class AccountComponent implements OnInit {
accountEntryCategoriesMap: Map<number, AccountEntryCategory>
accountEntryCategoriesInverseMap: Map<string, AccountEntryCategory>
presetDueAt: FormControl
constructor(
private accountService: AccountService,
@ -145,9 +146,17 @@ export class AccountComponent implements OnInit {
}
private async init(): Promise<void> {
let currentDate = new Date()
let y = currentDate.getFullYear().toString()
let m = (currentDate.getMonth()+1).toString()
if (m.length == 1) {
m = `0${m}`
}
this.presetDueAt = new FormControl(`${y}-${m}-01`)
this.messageService.add(`AccountComponent.init, account: ${this.selectedAccountId}`)
this.getAccount()
await this.getAccountEntryCategories()
}
ngOnInit(): void {