Fix automatic date/time setting on transaction edit/creation
Signed-off-by: William Brawner <me@wbrawner.com>
This commit is contained in:
parent
6aa76d6743
commit
89e75b2ff8
1 changed files with 4 additions and 4 deletions
|
@ -35,8 +35,8 @@ export class AddEditTransactionComponent implements OnInit, OnChanges {
|
|||
} else {
|
||||
d = new Date();
|
||||
}
|
||||
this.transactionDate = `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;
|
||||
this.currentTime = `${d.getHours()}:${d.getMinutes()}`;
|
||||
this.transactionDate = d.toLocaleDateString(undefined, {year: 'numeric', month: '2-digit', day: '2-digit'});
|
||||
this.currentTime = d.toLocaleTimeString(undefined, {hour: '2-digit', hour12: false, minute: '2-digit'});
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
|
@ -45,8 +45,8 @@ export class AddEditTransactionComponent implements OnInit, OnChanges {
|
|||
}
|
||||
|
||||
const d = new Date(changes.currentTransaction.currentValue.date * 1000);
|
||||
this.transactionDate = `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;
|
||||
this.currentTime = `${d.getHours()}:${d.getMinutes()}`;
|
||||
this.transactionDate = d.toLocaleDateString(undefined, {year: 'numeric', month: '2-digit', day: '2-digit'});
|
||||
this.currentTime = d.toLocaleTimeString(undefined, {hour: '2-digit', hour12: false, minute: '2-digit'});
|
||||
}
|
||||
|
||||
save(): void {
|
||||
|
|
Loading…
Reference in a new issue