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

@@ -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');