separate out date functions

This commit is contained in:
Patrick Nagurny
2019-06-27 16:37:46 -04:00
parent 5b720b79c4
commit 714a1b187b
12 changed files with 220 additions and 216 deletions

View File

@@ -18,7 +18,7 @@ import {
ValidationErrors
} from '@angular/forms';
import { AppError } from '../shared/error';
import { Util } from '../shared/util';
import { DateUtil } from '../shared/dateutil';
@Component({
selector: 'app-income',
@@ -51,9 +51,9 @@ export class IncomeReport {
this.org = this.orgService.getCurrentOrg();
this.startDate = new Date();
Util.setFirstOfMonth(this.startDate, this.org.timezone);
Util.setBeginOfDay(this.startDate, this.org.timezone);
this.endDate = Util.getOneMonthLater(this.startDate, this.org.timezone);
DateUtil.setFirstOfMonth(this.startDate, this.org.timezone);
DateUtil.setBeginOfDay(this.startDate, this.org.timezone);
this.endDate = DateUtil.getOneMonthLater(this.startDate, this.org.timezone);
let reportData = this.configService.get('reportData');
@@ -69,8 +69,8 @@ export class IncomeReport {
}
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]
startDate: [DateUtil.getLocalDateString(this.startDate, this.org.timezone), Validators.required],
endDate: [DateUtil.getLocalDateStringExcl(this.endDate, this.org.timezone), Validators.required]
});
this.treeSubscription = this.accountService.getAccountTreeWithPeriodBalance(this.startDate, this.endDate)
@@ -91,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.org.timezone);
this.endDate = Util.getDateFromLocalDateStringExcl(this.form.value.endDate, this.org.timezone);
this.startDate = DateUtil.getDateFromLocalDateString(this.form.value.startDate, this.org.timezone);
this.endDate = DateUtil.getDateFromLocalDateStringExcl(this.form.value.endDate, this.org.timezone);
let reportData = this.configService.get('reportData');