use timezone everywhere

This commit is contained in:
Patrick Nagurny
2019-06-27 14:11:05 -04:00
parent ca871a8021
commit b602cb1740
21 changed files with 150 additions and 114 deletions

View File

@@ -1,4 +1,4 @@
<h1>Balance Sheet<br>{{date | date:"shortDate"}} (<a [routerLink]="" (click)="toggleShowOptionsForm()">options</a>)</h1>
<h1>Balance Sheet<br>{{date.getTime() - 1 | datetz:"M/D/YYYY":org.timezone}} (<a [routerLink]="" (click)="toggleShowOptionsForm()">options</a>)</h1>
<div class="section">
<div *ngIf="showOptionsForm" class="card card-body">

View File

@@ -62,15 +62,16 @@ export class BalanceSheetReport {
}
}
this.org = this.orgService.getCurrentOrg();
this.form = fb.group({
date: [Util.getLocalDateStringExcl(this.date), Validators.required],
date: [Util.getLocalDateStringExcl(this.date, this.org.timezone), Validators.required],
priceSource: [this.priceSource, Validators.required]
});
}
ngOnInit() {
this.sessionService.setLoading(true);
this.org = this.orgService.getCurrentOrg();
this.amounts = {};
this.assetAccount = null;
@@ -133,7 +134,7 @@ export class BalanceSheetReport {
this.treeSubscription.unsubscribe();
//this.dataService.setLoading(true);
this.showOptionsForm = false;
this.date = Util.getDateFromLocalDateStringExcl(this.form.value.date);
this.date = Util.getDateFromLocalDateStringExcl(this.form.value.date, this.org.timezone);
this.priceSource = this.form.value.priceSource;
let reportData = this.configService.get('reportData');

View File

@@ -1,4 +1,4 @@
<h1>Income Statement<br>{{startDate | date:"shortDate"}} - {{endDate.getTime() - 1 | date:"shortDate"}} (<a [routerLink]="" (click)="toggleShowDateForm()">edit</a>)</h1>
<h1>Income Statement<br>{{startDate | datetz:"M/D/YYYY":org.timezone}} - {{endDate.getTime() - 1 | datetz:"M/D/YYYY":org.timezone}} (<a [routerLink]="" (click)="toggleShowDateForm()">edit</a>)</h1>
<div class="section">
<form *ngIf="showDateForm" [formGroup]="form" (ngSubmit)="onSubmit()">

View File

@@ -44,10 +44,16 @@ export class IncomeReport {
private orgService: OrgService,
private configService: ConfigService,
private sessionService: SessionService) {
}
ngOnInit() {
this.sessionService.setLoading(true);
this.org = this.orgService.getCurrentOrg();
this.startDate = new Date();
Util.setFirstOfMonth(this.startDate);
Util.setBeginOfDay(this.startDate);
this.endDate = Util.getOneMonthLater(this.startDate);
Util.setFirstOfMonth(this.startDate, this.org.timezone);
Util.setBeginOfDay(this.startDate, this.org.timezone);
this.endDate = Util.getOneMonthLater(this.startDate, this.org.timezone);
let reportData = this.configService.get('reportData');
@@ -62,15 +68,10 @@ export class IncomeReport {
}
}
this.form = fb.group({
startDate: [Util.getLocalDateString(this.startDate), Validators.required],
endDate: [Util.getLocalDateStringExcl(this.endDate), Validators.required]
this.form = this.fb.group({
startDate: [Util.getLocalDateString(this.startDate, this.org.timezone), Validators.required],
endDate: [Util.getLocalDateStringExcl(this.endDate, this.org.timezone), Validators.required]
});
}
ngOnInit() {
this.sessionService.setLoading(true);
this.org = this.orgService.getCurrentOrg();
this.treeSubscription = this.accountService.getAccountTreeWithPeriodBalance(this.startDate, this.endDate)
.subscribe(tree => {
@@ -90,8 +91,8 @@ export class IncomeReport {
this.treeSubscription.unsubscribe();
//this.dataService.setLoading(true);
this.showDateForm = false;
this.startDate = Util.getDateFromLocalDateString(this.form.value.startDate);
this.endDate = Util.getDateFromLocalDateStringExcl(this.form.value.endDate);
this.startDate = Util.getDateFromLocalDateString(this.form.value.startDate, this.org.timezone);
this.endDate = Util.getDateFromLocalDateStringExcl(this.form.value.endDate, this.org.timezone);
let reportData = this.configService.get('reportData');