diff --git a/overlord/src/app/attendance/attendance.component.ts b/overlord/src/app/attendance/attendance.component.ts index 3668f5ff..e016bd4b 100644 --- a/overlord/src/app/attendance/attendance.component.ts +++ b/overlord/src/app/attendance/attendance.component.ts @@ -53,7 +53,7 @@ export class AttendanceComponent implements OnInit { public attendanceObservable = new BehaviorSubject([]); dataSource: AttendanceDataSource = new AttendanceDataSource(this.attendanceObservable); form: FormGroup<{ - date: FormControl; + date: FormControl; attendances: FormArray< FormGroup<{ attendanceType: FormControl; @@ -75,7 +75,7 @@ export class AttendanceComponent implements OnInit { constructor() { this.form = new FormGroup({ - date: new FormControl(new Date(), { nonNullable: true }), + date: new FormControl(moment(new Date()), { nonNullable: true }), attendances: new FormArray }>>([]), }); } @@ -86,7 +86,7 @@ export class AttendanceComponent implements OnInit { this.info = data.info; this.attendanceTypes = data.attendanceTypes; - this.form.controls.date.setValue(moment(this.info.date, 'DD-MMM-YYYY').toDate()); + this.form.controls.date.setValue(moment(this.info.date, 'DD-MMM-YYYY')); this.form.controls.attendances.clear(); this.info.body.forEach((x) => this.form.controls.attendances.push( diff --git a/overlord/src/app/balance-sheet/balance-sheet.component.ts b/overlord/src/app/balance-sheet/balance-sheet.component.ts index 77501697..21f3b611 100644 --- a/overlord/src/app/balance-sheet/balance-sheet.component.ts +++ b/overlord/src/app/balance-sheet/balance-sheet.component.ts @@ -44,7 +44,7 @@ export class BalanceSheetComponent implements OnInit { info: BalanceSheet = new BalanceSheet(); dataSource: BalanceSheetDataSource = new BalanceSheetDataSource(this.info.body, this.paginator, this.sort); form: FormGroup<{ - date: FormControl; + date: FormControl; }>; /** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */ @@ -59,7 +59,7 @@ export class BalanceSheetComponent implements OnInit { constructor() { this.form = new FormGroup({ - date: new FormControl(new Date(), { nonNullable: true }), + date: new FormControl(moment(new Date()), { nonNullable: true }), }); } @@ -69,7 +69,7 @@ export class BalanceSheetComponent implements OnInit { this.info = data.info; this.form.setValue({ - date: moment(this.info.date, 'DD-MMM-YYYY').toDate(), + date: moment(this.info.date, 'DD-MMM-YYYY'), }); this.dataSource = new BalanceSheetDataSource(this.info.body, this.paginator, this.sort); }); diff --git a/overlord/src/app/cash-flow/cash-flow.component.ts b/overlord/src/app/cash-flow/cash-flow.component.ts index 980593e9..9bdcec6b 100644 --- a/overlord/src/app/cash-flow/cash-flow.component.ts +++ b/overlord/src/app/cash-flow/cash-flow.component.ts @@ -41,8 +41,8 @@ export class CashFlowComponent implements OnInit { info: CashFlow = new CashFlow(); dataSource: CashFlowDataSource = new CashFlowDataSource(CashFlow.Data(this.info)); form: FormGroup<{ - startDate: FormControl; - finishDate: FormControl; + startDate: FormControl; + finishDate: FormControl; }>; /** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */ @@ -57,8 +57,8 @@ export class CashFlowComponent implements OnInit { constructor() { this.form = new FormGroup({ - startDate: new FormControl(new Date(), { nonNullable: true }), - finishDate: new FormControl(new Date(), { nonNullable: true }), + startDate: new FormControl(moment(new Date()), { nonNullable: true }), + finishDate: new FormControl(moment(new Date()), { nonNullable: true }), }); } @@ -68,8 +68,8 @@ export class CashFlowComponent implements OnInit { this.info = data.info; this.form.setValue({ - startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), - finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), + startDate: moment(this.info.startDate, 'DD-MMM-YYYY'), + finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'), }); this.dataSource = new CashFlowDataSource(CashFlow.Data(this.info)); }); diff --git a/overlord/src/app/closing-stock/closing-stock.component.ts b/overlord/src/app/closing-stock/closing-stock.component.ts index f5877ef7..cdda4a0c 100644 --- a/overlord/src/app/closing-stock/closing-stock.component.ts +++ b/overlord/src/app/closing-stock/closing-stock.component.ts @@ -63,7 +63,7 @@ export class ClosingStockComponent implements OnInit { info: ClosingStock = new ClosingStock(); dataSource: ClosingStockDataSource = new ClosingStockDataSource(this.info.items, this.paginator, this.sort); form: FormGroup<{ - date: FormControl; + date: FormControl; costCentre: FormControl; stocks: FormArray< FormGroup<{ @@ -88,7 +88,7 @@ export class ClosingStockComponent implements OnInit { constructor() { this.costCentres = []; this.form = new FormGroup({ - date: new FormControl(new Date(), { nonNullable: true }), + date: new FormControl(moment(new Date()), { nonNullable: true }), costCentre: new FormControl(null), stocks: new FormArray; costCentre: FormControl }>>( [], @@ -102,7 +102,7 @@ export class ClosingStockComponent implements OnInit { this.info = data.info; this.costCentres = data.costCentres; this.form.patchValue({ - date: moment(this.info.date, 'DD-MMM-YYYY').toDate(), + date: moment(this.info.date, 'DD-MMM-YYYY'), costCentre: this.info.costCentre.id, }); this.form.controls.stocks.clear(); diff --git a/overlord/src/app/daybook/daybook.component.ts b/overlord/src/app/daybook/daybook.component.ts index 5e61aac5..686b33a8 100644 --- a/overlord/src/app/daybook/daybook.component.ts +++ b/overlord/src/app/daybook/daybook.component.ts @@ -43,8 +43,8 @@ export class DaybookComponent implements OnInit { info: Daybook = new Daybook(); dataSource: DaybookDataSource = new DaybookDataSource(this.info.body, this.paginator, this.sort); form: FormGroup<{ - startDate: FormControl; - finishDate: FormControl; + startDate: FormControl; + finishDate: FormControl; }>; selectedRowId = ''; @@ -60,8 +60,8 @@ export class DaybookComponent implements OnInit { constructor() { this.form = new FormGroup({ - startDate: new FormControl(new Date(), { nonNullable: true }), - finishDate: new FormControl(new Date(), { nonNullable: true }), + startDate: new FormControl(moment(new Date()), { nonNullable: true }), + finishDate: new FormControl(moment(new Date()), { nonNullable: true }), }); } @@ -71,8 +71,8 @@ export class DaybookComponent implements OnInit { this.info = data.info; this.form.setValue({ - startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), - finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), + startDate: moment(this.info.startDate, 'DD-MMM-YYYY'), + finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'), }); this.dataSource = new DaybookDataSource(this.info.body, this.paginator, this.sort); }); diff --git a/overlord/src/app/employee-attendance/employee-attendance.component.ts b/overlord/src/app/employee-attendance/employee-attendance.component.ts index 001033f9..1dbc6f23 100644 --- a/overlord/src/app/employee-attendance/employee-attendance.component.ts +++ b/overlord/src/app/employee-attendance/employee-attendance.component.ts @@ -63,8 +63,8 @@ export class EmployeeAttendanceComponent implements OnInit, AfterViewInit { dataSource: EmployeeAttendanceDataSource = new EmployeeAttendanceDataSource(this.employeeAttendanceObservable); form: FormGroup<{ - startDate: FormControl; - finishDate: FormControl; + startDate: FormControl; + finishDate: FormControl; employee: FormControl; attendances: FormArray< FormGroup<{ @@ -89,8 +89,8 @@ export class EmployeeAttendanceComponent implements OnInit, AfterViewInit { constructor() { this.form = new FormGroup({ - startDate: new FormControl(new Date(), { nonNullable: true }), - finishDate: new FormControl(new Date(), { nonNullable: true }), + startDate: new FormControl(moment(new Date()), { nonNullable: true }), + finishDate: new FormControl(moment(new Date()), { nonNullable: true }), employee: new FormControl(null), attendances: new FormArray }>>([]), }); @@ -108,8 +108,8 @@ export class EmployeeAttendanceComponent implements OnInit, AfterViewInit { this.info = data.info; this.attendanceTypes = data.attendanceTypes; - this.form.controls.startDate.setValue(moment(this.info.startDate, 'DD-MMM-YYYY').toDate()); - this.form.controls.finishDate.setValue(moment(this.info.finishDate, 'DD-MMM-YYYY').toDate()); + this.form.controls.startDate.setValue(moment(this.info.startDate, 'DD-MMM-YYYY')); + this.form.controls.finishDate.setValue(moment(this.info.finishDate, 'DD-MMM-YYYY')); this.form.controls.employee.setValue(this.info.employee?.name ?? ''); this.form.controls.attendances.clear(); this.info.body.forEach((x) => diff --git a/overlord/src/app/employee-benefits/employee-benefits.component.ts b/overlord/src/app/employee-benefits/employee-benefits.component.ts index 65a4760b..23af2fdb 100644 --- a/overlord/src/app/employee-benefits/employee-benefits.component.ts +++ b/overlord/src/app/employee-benefits/employee-benefits.component.ts @@ -64,7 +64,7 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit { public benefitsObservable = new BehaviorSubject([]); dataSource: EmployeeBenefitsDataSource = new EmployeeBenefitsDataSource(this.benefitsObservable); form: FormGroup<{ - date: FormControl; + date: FormControl; addRow: FormGroup<{ employee: FormControl; grossSalary: FormControl; @@ -99,7 +99,7 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit { constructor() { this.form = new FormGroup({ - date: new FormControl(new Date(), { nonNullable: true }), + date: new FormControl(moment(new Date()), { nonNullable: true }), addRow: new FormGroup({ employee: new FormControl(''), grossSalary: new FormControl(''), @@ -149,7 +149,7 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit { loadVoucher(voucher: Voucher) { this.voucher = voucher; this.form.setValue({ - date: moment(this.voucher.date, 'DD-MMM-YYYY').toDate(), + date: moment(this.voucher.date, 'DD-MMM-YYYY'), addRow: { employee: '1', grossSalary: '', diff --git a/overlord/src/app/employee/employee-detail/employee-detail.component.ts b/overlord/src/app/employee/employee-detail/employee-detail.component.ts index 01173765..c1d95676 100644 --- a/overlord/src/app/employee/employee-detail/employee-detail.component.ts +++ b/overlord/src/app/employee/employee-detail/employee-detail.component.ts @@ -52,8 +52,8 @@ export class EmployeeDetailComponent implements OnInit, AfterViewInit { points: FormControl; isActive: FormControl; costCentre: FormControl; - joiningDate: FormControl; - leavingDate: FormControl; + joiningDate: FormControl; + leavingDate: FormControl; }>; costCentres: CostCentre[] = []; @@ -68,8 +68,8 @@ export class EmployeeDetailComponent implements OnInit, AfterViewInit { points: new FormControl(null), isActive: new FormControl(true, { nonNullable: true }), costCentre: new FormControl(null), - joiningDate: new FormControl(new Date(), { nonNullable: true }), - leavingDate: new FormControl(null), + joiningDate: new FormControl(moment(new Date()), { nonNullable: true }), + leavingDate: new FormControl(null), }); // Listen to IsActive Changes this.form.controls.isActive.valueChanges.subscribe((x) => { @@ -96,8 +96,8 @@ export class EmployeeDetailComponent implements OnInit, AfterViewInit { points: this.item.points || '', isActive: this.item.isActive, costCentre: this.item.costCentre.id ?? '', - joiningDate: this.item.joiningDate ? moment(this.item.joiningDate, 'DD-MMM-YYYY').toDate() : new Date(), - leavingDate: this.item.isActive ? null : moment(this.item.leavingDate, 'DD-MMM-YYYY').toDate(), + joiningDate: this.item.joiningDate ? moment(this.item.joiningDate, 'DD-MMM-YYYY') : moment(new Date()), + leavingDate: this.item.isActive ? null : moment(this.item.leavingDate, 'DD-MMM-YYYY'), }); } diff --git a/overlord/src/app/entries/entries.component.ts b/overlord/src/app/entries/entries.component.ts index 9a2ff8ac..b9a48e4e 100644 --- a/overlord/src/app/entries/entries.component.ts +++ b/overlord/src/app/entries/entries.component.ts @@ -51,8 +51,8 @@ export class EntriesComponent implements OnInit { info: Report = new Report(); dataSource: EntriesDatasource; form: FormGroup<{ - startDate: FormControl; - finishDate: FormControl; + startDate: FormControl; + finishDate: FormControl; posted: FormControl; issue: FormControl; }>; @@ -71,8 +71,8 @@ export class EntriesComponent implements OnInit { constructor() { this.form = new FormGroup({ - startDate: new FormControl(new Date(), { nonNullable: true }), - finishDate: new FormControl(new Date(), { nonNullable: true }), + startDate: new FormControl(moment(new Date()), { nonNullable: true }), + finishDate: new FormControl(moment(new Date()), { nonNullable: true }), posted: new FormControl(null), issue: new FormControl(false, { nonNullable: true }), }); @@ -84,8 +84,8 @@ export class EntriesComponent implements OnInit { const data = value as { info: Report }; this.info = data.info; const queryMap = this.route.snapshot.queryParamMap; - const startDate = moment(queryMap.get('s') || undefined, 'DD-MMM-YYYY').toDate(); - const finishDate = moment(queryMap.get('f') || undefined, 'DD-MMM-YYYY').toDate(); + const startDate = moment(queryMap.get('s') || undefined, 'DD-MMM-YYYY'); + const finishDate = moment(queryMap.get('f') || undefined, 'DD-MMM-YYYY'); const postedO = queryMap.get('p'); this.posted = postedO !== null ? postedO === 'true' : null; const pageSizeO = queryMap.get('ps'); diff --git a/overlord/src/app/incentive/incentive.component.ts b/overlord/src/app/incentive/incentive.component.ts index 6c69de9d..005a10ea 100644 --- a/overlord/src/app/incentive/incentive.component.ts +++ b/overlord/src/app/incentive/incentive.component.ts @@ -56,7 +56,7 @@ export class IncentiveComponent implements OnInit { public incentiveObservable = new BehaviorSubject([]); dataSource: IncentiveDataSource = new IncentiveDataSource(this.incentiveObservable); form: FormGroup<{ - date: FormControl; + date: FormControl; incentives: FormArray< FormGroup<{ points: FormControl; @@ -79,7 +79,7 @@ export class IncentiveComponent implements OnInit { constructor() { this.form = new FormGroup({ - date: new FormControl(new Date(), { nonNullable: true }), + date: new FormControl(moment(new Date()), { nonNullable: true }), incentives: new FormArray }>>([]), }); // Listen to Date Change @@ -103,7 +103,7 @@ export class IncentiveComponent implements OnInit { loadVoucher(voucher: Voucher) { this.voucher = voucher; - this.form.controls.date.setValue(moment(this.voucher.date, 'DD-MMM-YYYY').toDate()); + this.form.controls.date.setValue(moment(this.voucher.date, 'DD-MMM-YYYY')); this.form.controls.incentives.clear(); this.voucher.incentives.forEach((x) => this.form.controls.incentives.push( diff --git a/overlord/src/app/ledger/ledger.component.ts b/overlord/src/app/ledger/ledger.component.ts index 6ecf941a..9c72b5d0 100644 --- a/overlord/src/app/ledger/ledger.component.ts +++ b/overlord/src/app/ledger/ledger.component.ts @@ -82,8 +82,8 @@ export class LedgerComponent implements OnInit, AfterViewInit { allTags: Tag[] = []; tags: string[] = []; form: FormGroup<{ - startDate: FormControl; - finishDate: FormControl; + startDate: FormControl; + finishDate: FormControl; account: FormControl; tags: FormControl; }>; @@ -103,8 +103,8 @@ export class LedgerComponent implements OnInit, AfterViewInit { constructor() { this.form = new FormGroup({ - startDate: new FormControl(new Date(), { nonNullable: true }), - finishDate: new FormControl(new Date(), { nonNullable: true }), + startDate: new FormControl(moment(new Date()), { nonNullable: true }), + finishDate: new FormControl(moment(new Date()), { nonNullable: true }), account: new FormControl(null), tags: new FormControl([], { nonNullable: true }), }); @@ -128,8 +128,8 @@ export class LedgerComponent implements OnInit, AfterViewInit { ]; this.form.setValue({ account: this.info.account?.name ?? '', - startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), - finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), + startDate: moment(this.info.startDate, 'DD-MMM-YYYY'), + finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'), tags: this.tags, }); this.body.next(this.info.body); diff --git a/overlord/src/app/mozimo-daily-register/mozimo-daily-register.component.ts b/overlord/src/app/mozimo-daily-register/mozimo-daily-register.component.ts index 509a3b4a..9e041209 100644 --- a/overlord/src/app/mozimo-daily-register/mozimo-daily-register.component.ts +++ b/overlord/src/app/mozimo-daily-register/mozimo-daily-register.component.ts @@ -63,7 +63,7 @@ export class MozimoDailyRegisterComponent implements OnInit { dataSource: MozimoDailyRegisterDataSource = new MozimoDailyRegisterDataSource(this.body); form: FormGroup<{ - date: FormControl; + date: FormControl; items: FormArray< FormGroup<{ received: FormControl; @@ -80,7 +80,7 @@ export class MozimoDailyRegisterComponent implements OnInit { constructor() { this.form = new FormGroup({ - date: new FormControl(new Date(), { nonNullable: true }), + date: new FormControl(moment(new Date()), { nonNullable: true }), items: new FormArray< FormGroup<{ received: FormControl; @@ -98,7 +98,7 @@ export class MozimoDailyRegisterComponent implements OnInit { const data = value as { info: MozimoDailyRegister }; this.info = data.info; this.form.patchValue({ - date: moment(this.info.date, 'DD-MMM-YYYY').toDate(), + date: moment(this.info.date, 'DD-MMM-YYYY'), }); this.form.controls.items.clear(); this.info.body.forEach((x) => diff --git a/overlord/src/app/mozimo-product-register/mozimo-product-register.component.ts b/overlord/src/app/mozimo-product-register/mozimo-product-register.component.ts index 3aa488a6..141b86c9 100644 --- a/overlord/src/app/mozimo-product-register/mozimo-product-register.component.ts +++ b/overlord/src/app/mozimo-product-register/mozimo-product-register.component.ts @@ -67,8 +67,8 @@ export class MozimoProductRegisterComponent implements OnInit { dataSource: MozimoProductRegisterDataSource = new MozimoProductRegisterDataSource(this.body); form: FormGroup<{ - startDate: FormControl; - finishDate: FormControl; + startDate: FormControl; + finishDate: FormControl; product: FormControl; items: FormArray< FormGroup<{ @@ -88,8 +88,8 @@ export class MozimoProductRegisterComponent implements OnInit { constructor() { this.form = new FormGroup({ - startDate: new FormControl(new Date(), { nonNullable: true }), - finishDate: new FormControl(new Date(), { nonNullable: true }), + startDate: new FormControl(moment(new Date()), { nonNullable: true }), + finishDate: new FormControl(moment(new Date()), { nonNullable: true }), product: new FormControl(null), items: new FormArray< FormGroup<{ @@ -115,8 +115,8 @@ export class MozimoProductRegisterComponent implements OnInit { this.info = data.info; this.form.patchValue({ product: this.info.product?.name ?? '', - startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), - finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), + startDate: moment(this.info.startDate, 'DD-MMM-YYYY'), + finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'), }); this.form.controls.items.clear(); this.info.body.forEach((x) => diff --git a/overlord/src/app/net-transactions/net-transactions.component.ts b/overlord/src/app/net-transactions/net-transactions.component.ts index 766aafde..19e5558c 100644 --- a/overlord/src/app/net-transactions/net-transactions.component.ts +++ b/overlord/src/app/net-transactions/net-transactions.component.ts @@ -44,8 +44,8 @@ export class NetTransactionsComponent implements OnInit { info: NetTransactions = new NetTransactions(); dataSource: NetTransactionsDataSource = new NetTransactionsDataSource(this.info.body, this.paginator, this.sort); form: FormGroup<{ - startDate: FormControl; - finishDate: FormControl; + startDate: FormControl; + finishDate: FormControl; }>; selectedRowId = ''; @@ -61,8 +61,8 @@ export class NetTransactionsComponent implements OnInit { constructor() { this.form = new FormGroup({ - startDate: new FormControl(new Date(), { nonNullable: true }), - finishDate: new FormControl(new Date(), { nonNullable: true }), + startDate: new FormControl(moment(new Date()), { nonNullable: true }), + finishDate: new FormControl(moment(new Date()), { nonNullable: true }), }); } @@ -72,8 +72,8 @@ export class NetTransactionsComponent implements OnInit { this.info = data.info; this.form.setValue({ - startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), - finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), + startDate: moment(this.info.startDate, 'DD-MMM-YYYY'), + finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'), }); this.dataSource = new NetTransactionsDataSource(this.info.body, this.paginator, this.sort); }); diff --git a/overlord/src/app/period/period-detail/period-detail.component.ts b/overlord/src/app/period/period-detail/period-detail.component.ts index 64a28e3d..d8748e84 100644 --- a/overlord/src/app/period/period-detail/period-detail.component.ts +++ b/overlord/src/app/period/period-detail/period-detail.component.ts @@ -36,8 +36,8 @@ export class PeriodDetailComponent implements OnInit { @ViewChild('startDateElement', { static: true }) startDate!: ElementRef; form: FormGroup<{ - validFrom: FormControl; - validTill: FormControl; + validFrom: FormControl; + validTill: FormControl; }>; item: Period = new Period(); @@ -51,8 +51,8 @@ export class PeriodDetailComponent implements OnInit { constructor() { this.form = new FormGroup({ - validFrom: new FormControl(new Date(), { nonNullable: true }), - validTill: new FormControl(new Date(), { nonNullable: true }), + validFrom: new FormControl(moment(new Date()), { nonNullable: true }), + validTill: new FormControl(moment(new Date()), { nonNullable: true }), }); } @@ -67,8 +67,8 @@ export class PeriodDetailComponent implements OnInit { showItem(item: Period) { this.item = item; this.form.setValue({ - validFrom: moment(this.item.validFrom, 'DD-MMM-YYYY').toDate(), - validTill: moment(this.item.validTill, 'DD-MMM-YYYY').toDate(), + validFrom: moment(this.item.validFrom, 'DD-MMM-YYYY'), + validTill: moment(this.item.validTill, 'DD-MMM-YYYY'), }); } diff --git a/overlord/src/app/product-ledger/product-ledger.component.ts b/overlord/src/app/product-ledger/product-ledger.component.ts index 28ea8d73..89d553f7 100644 --- a/overlord/src/app/product-ledger/product-ledger.component.ts +++ b/overlord/src/app/product-ledger/product-ledger.component.ts @@ -62,8 +62,8 @@ export class ProductLedgerComponent implements OnInit, AfterViewInit { info: ProductLedger = new ProductLedger(); dataSource: ProductLedgerDataSource = new ProductLedgerDataSource(this.info.body, this.paginator, this.sort); form: FormGroup<{ - startDate: FormControl; - finishDate: FormControl; + startDate: FormControl; + finishDate: FormControl; product: FormControl; }>; @@ -99,8 +99,8 @@ export class ProductLedgerComponent implements OnInit, AfterViewInit { constructor() { this.form = new FormGroup({ - startDate: new FormControl(new Date(), { nonNullable: true }), - finishDate: new FormControl(new Date(), { nonNullable: true }), + startDate: new FormControl(moment(new Date()), { nonNullable: true }), + finishDate: new FormControl(moment(new Date()), { nonNullable: true }), product: new FormControl(null), }); @@ -119,8 +119,8 @@ export class ProductLedgerComponent implements OnInit, AfterViewInit { this.calculateTotals(); this.form.setValue({ product: this.info.product?.name ?? '', - startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), - finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), + startDate: moment(this.info.startDate, 'DD-MMM-YYYY'), + finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'), }); this.dataSource = new ProductLedgerDataSource(this.info.body, this.paginator, this.sort); }); diff --git a/overlord/src/app/profit-loss/profit-loss.component.ts b/overlord/src/app/profit-loss/profit-loss.component.ts index 1b207302..b1453f5c 100644 --- a/overlord/src/app/profit-loss/profit-loss.component.ts +++ b/overlord/src/app/profit-loss/profit-loss.component.ts @@ -42,8 +42,8 @@ export class ProfitLossComponent implements OnInit { info: ProfitLoss = new ProfitLoss(); dataSource: ProfitLossDataSource = new ProfitLossDataSource(this.info.body, this.paginator, this.sort); form: FormGroup<{ - startDate: FormControl; - finishDate: FormControl; + startDate: FormControl; + finishDate: FormControl; }>; selectedRowId = ''; @@ -59,8 +59,8 @@ export class ProfitLossComponent implements OnInit { constructor() { this.form = new FormGroup({ - startDate: new FormControl(new Date(), { nonNullable: true }), - finishDate: new FormControl(new Date(), { nonNullable: true }), + startDate: new FormControl(moment(new Date()), { nonNullable: true }), + finishDate: new FormControl(moment(new Date()), { nonNullable: true }), }); } @@ -70,8 +70,8 @@ export class ProfitLossComponent implements OnInit { this.info = data.info; this.form.setValue({ - startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), - finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), + startDate: moment(this.info.startDate, 'DD-MMM-YYYY'), + finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'), }); this.dataSource = new ProfitLossDataSource(this.info.body, this.paginator, this.sort); }); diff --git a/overlord/src/app/purchase-entries/purchase-entries.component.ts b/overlord/src/app/purchase-entries/purchase-entries.component.ts index 5c3d5198..f2b1da5b 100644 --- a/overlord/src/app/purchase-entries/purchase-entries.component.ts +++ b/overlord/src/app/purchase-entries/purchase-entries.component.ts @@ -45,8 +45,8 @@ export class PurchaseEntriesComponent implements OnInit { info: PurchaseEntries = new PurchaseEntries(); dataSource: PurchaseEntriesDataSource = new PurchaseEntriesDataSource(this.info.body, this.paginator, this.sort); form: FormGroup<{ - startDate: FormControl; - finishDate: FormControl; + startDate: FormControl; + finishDate: FormControl; }>; selectedRowId = ''; @@ -62,8 +62,8 @@ export class PurchaseEntriesComponent implements OnInit { constructor() { this.form = new FormGroup({ - startDate: new FormControl(new Date(), { nonNullable: true }), - finishDate: new FormControl(new Date(), { nonNullable: true }), + startDate: new FormControl(moment(new Date()), { nonNullable: true }), + finishDate: new FormControl(moment(new Date()), { nonNullable: true }), }); } @@ -73,8 +73,8 @@ export class PurchaseEntriesComponent implements OnInit { this.info = data.info; this.form.setValue({ - startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), - finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), + startDate: moment(this.info.startDate, 'DD-MMM-YYYY'), + finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'), }); this.dataSource = new PurchaseEntriesDataSource(this.info.body, this.paginator, this.sort); }); diff --git a/overlord/src/app/purchases/purchases.component.ts b/overlord/src/app/purchases/purchases.component.ts index 02f067a4..c344dae1 100644 --- a/overlord/src/app/purchases/purchases.component.ts +++ b/overlord/src/app/purchases/purchases.component.ts @@ -45,8 +45,8 @@ export class PurchasesComponent implements OnInit { info: Purchases = new Purchases(); dataSource: PurchasesDataSource = new PurchasesDataSource(this.info.body, this.paginator, this.sort); form: FormGroup<{ - startDate: FormControl; - finishDate: FormControl; + startDate: FormControl; + finishDate: FormControl; }>; selectedRowId = ''; @@ -62,8 +62,8 @@ export class PurchasesComponent implements OnInit { constructor() { this.form = new FormGroup({ - startDate: new FormControl(new Date(), { nonNullable: true }), - finishDate: new FormControl(new Date(), { nonNullable: true }), + startDate: new FormControl(moment(new Date()), { nonNullable: true }), + finishDate: new FormControl(moment(new Date()), { nonNullable: true }), }); } @@ -73,8 +73,8 @@ export class PurchasesComponent implements OnInit { this.info = data.info; this.form.setValue({ - startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), - finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), + startDate: moment(this.info.startDate, 'DD-MMM-YYYY'), + finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'), }); this.dataSource = new PurchasesDataSource(this.info.body, this.paginator, this.sort); }); diff --git a/overlord/src/app/rate-contract/rate-contract-detail/rate-contract-detail.component.ts b/overlord/src/app/rate-contract/rate-contract-detail/rate-contract-detail.component.ts index 5236f547..ae9cc833 100644 --- a/overlord/src/app/rate-contract/rate-contract-detail/rate-contract-detail.component.ts +++ b/overlord/src/app/rate-contract/rate-contract-detail/rate-contract-detail.component.ts @@ -66,10 +66,10 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit { public itemsObservable = new BehaviorSubject([]); dataSource: RateContractDetailDatasource = new RateContractDetailDatasource(this.itemsObservable); form: FormGroup<{ - date: FormControl; + date: FormControl; account: FormControl; - validFrom: FormControl; - validTill: FormControl; + validFrom: FormControl; + validTill: FormControl; addRow: FormGroup<{ product: FormControl; price: FormControl; @@ -96,10 +96,10 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit { constructor() { this.form = new FormGroup({ - date: new FormControl(new Date(), { nonNullable: true }), + date: new FormControl(moment(new Date()), { nonNullable: true }), account: new FormControl(null), - validFrom: new FormControl(new Date(), { nonNullable: true }), - validTill: new FormControl(new Date(), { nonNullable: true }), + validFrom: new FormControl(moment(new Date()), { nonNullable: true }), + validTill: new FormControl(moment(new Date()), { nonNullable: true }), addRow: new FormGroup({ product: new FormControl(''), price: new FormControl('', { nonNullable: true }), @@ -129,9 +129,9 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit { loadItem(item: RateContract) { this.item = item; this.form.setValue({ - date: moment(this.item.date, 'DD-MMM-YYYY').toDate(), - validFrom: moment(this.item.validFrom, 'DD-MMM-YYYY').toDate(), - validTill: moment(this.item.validTill, 'DD-MMM-YYYY').toDate(), + date: moment(this.item.date, 'DD-MMM-YYYY'), + validFrom: moment(this.item.validFrom, 'DD-MMM-YYYY'), + validTill: moment(this.item.validTill, 'DD-MMM-YYYY'), account: this.item.vendor?.name ?? '', addRow: { product: '', diff --git a/overlord/src/app/raw-material-cost/raw-material-cost.component.ts b/overlord/src/app/raw-material-cost/raw-material-cost.component.ts index 951af88d..80b3019b 100644 --- a/overlord/src/app/raw-material-cost/raw-material-cost.component.ts +++ b/overlord/src/app/raw-material-cost/raw-material-cost.component.ts @@ -49,8 +49,8 @@ export class RawMaterialCostComponent implements OnInit { info: RawMaterialCost = new RawMaterialCost(); dataSource: RawMaterialCostDataSource = new RawMaterialCostDataSource(this.info.body, this.paginator, this.sort); form: FormGroup<{ - startDate: FormControl; - finishDate: FormControl; + startDate: FormControl; + finishDate: FormControl; }>; debitQuantity = 0; @@ -73,8 +73,8 @@ export class RawMaterialCostComponent implements OnInit { constructor() { this.form = new FormGroup({ - startDate: new FormControl(new Date(), { nonNullable: true }), - finishDate: new FormControl(new Date(), { nonNullable: true }), + startDate: new FormControl(moment(new Date()), { nonNullable: true }), + finishDate: new FormControl(moment(new Date()), { nonNullable: true }), }); } @@ -85,8 +85,8 @@ export class RawMaterialCostComponent implements OnInit { this.info = data.info; this.displayedColumns = this.info.id ? this.columnsId : this.columnsNoId; this.form.setValue({ - startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), - finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), + startDate: moment(this.info.startDate, 'DD-MMM-YYYY'), + finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'), }); this.dataSource = new RawMaterialCostDataSource(this.info.body, this.paginator, this.sort); }); diff --git a/overlord/src/app/recipe-template/recipe-template-detail/recipe-template-detail.component.ts b/overlord/src/app/recipe-template/recipe-template-detail/recipe-template-detail.component.ts index 329ed082..edcd73d1 100644 --- a/overlord/src/app/recipe-template/recipe-template-detail/recipe-template-detail.component.ts +++ b/overlord/src/app/recipe-template/recipe-template-detail/recipe-template-detail.component.ts @@ -39,7 +39,7 @@ export class RecipeTemplateDetailComponent implements OnInit, AfterViewInit { @ViewChild('nameElement', { static: true }) nameElement!: ElementRef; form: FormGroup<{ name: FormControl; - date: FormControl; + date: FormControl; text: FormControl; selected: FormControl; }>; @@ -49,7 +49,7 @@ export class RecipeTemplateDetailComponent implements OnInit, AfterViewInit { constructor() { this.form = new FormGroup({ name: new FormControl('', { nonNullable: true }), - date: new FormControl(new Date(), { nonNullable: true }), + date: new FormControl(moment(new Date()), { nonNullable: true }), text: new FormControl('', { nonNullable: true }), selected: new FormControl(false, { nonNullable: true }), }); @@ -67,7 +67,7 @@ export class RecipeTemplateDetailComponent implements OnInit, AfterViewInit { this.item = item; this.form.setValue({ name: this.item.name, - date: moment(this.item.date, 'DD-MMM-YYYY').toDate(), + date: moment(this.item.date, 'DD-MMM-YYYY'), text: this.item.text, selected: this.item.selected, }); diff --git a/overlord/src/app/recipe/recipe-detail/recipe-detail.component.ts b/overlord/src/app/recipe/recipe-detail/recipe-detail.component.ts index 008e7cd6..d76b6ffb 100644 --- a/overlord/src/app/recipe/recipe-detail/recipe-detail.component.ts +++ b/overlord/src/app/recipe/recipe-detail/recipe-detail.component.ts @@ -63,7 +63,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit { public itemsObservable = new BehaviorSubject([]); dataSource: RecipeDetailDatasource = new RecipeDetailDatasource(this.itemsObservable); form: FormGroup<{ - date: FormControl; + date: FormControl; source: FormControl; recipeYield: FormControl; product: FormControl; @@ -90,7 +90,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit { this.product = null; this.ingredient = null; this.form = new FormGroup({ - date: new FormControl(new Date(), { nonNullable: true }), + date: new FormControl(moment(new Date()), { nonNullable: true }), source: new FormControl('', { nonNullable: true }), recipeYield: new FormControl(null), product: new FormControl(new ProductSku()), @@ -132,7 +132,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit { showItem(item: Recipe) { this.item = item; this.form.setValue({ - date: moment(item.date, 'DD-MMM-YYYY').toDate(), + date: moment(item.date, 'DD-MMM-YYYY'), source: item.source, recipeYield: `${item.recipeYield}`, product: item.sku, diff --git a/overlord/src/app/stock-movement/stock-movement.component.ts b/overlord/src/app/stock-movement/stock-movement.component.ts index 692632ca..95a9b98c 100644 --- a/overlord/src/app/stock-movement/stock-movement.component.ts +++ b/overlord/src/app/stock-movement/stock-movement.component.ts @@ -43,8 +43,8 @@ export class StockMovementComponent implements OnInit { info: StockMovement = new StockMovement(); dataSource: StockMovementDataSource = new StockMovementDataSource(this.info.body, this.paginator, this.sort); form: FormGroup<{ - startDate: FormControl; - finishDate: FormControl; + startDate: FormControl; + finishDate: FormControl; }>; selectedRowId = ''; @@ -60,8 +60,8 @@ export class StockMovementComponent implements OnInit { constructor() { this.form = new FormGroup({ - startDate: new FormControl(new Date(), { nonNullable: true }), - finishDate: new FormControl(new Date(), { nonNullable: true }), + startDate: new FormControl(moment(new Date()), { nonNullable: true }), + finishDate: new FormControl(moment(new Date()), { nonNullable: true }), }); } @@ -71,8 +71,8 @@ export class StockMovementComponent implements OnInit { this.info = data.info; this.form.setValue({ - startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(), - finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(), + startDate: moment(this.info.startDate, 'DD-MMM-YYYY'), + finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'), }); this.dataSource = new StockMovementDataSource(this.info.body, this.paginator, this.sort); }); diff --git a/overlord/src/app/trial-balance/trial-balance.component.ts b/overlord/src/app/trial-balance/trial-balance.component.ts index 7b0ed2b6..f259368c 100644 --- a/overlord/src/app/trial-balance/trial-balance.component.ts +++ b/overlord/src/app/trial-balance/trial-balance.component.ts @@ -44,7 +44,7 @@ export class TrialBalanceComponent implements OnInit { info: TrialBalance = new TrialBalance(); dataSource: TrialBalanceDataSource = new TrialBalanceDataSource(this.info.body, this.paginator, this.sort); form: FormGroup<{ - date: FormControl; + date: FormControl; }>; /** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */ @@ -59,7 +59,7 @@ export class TrialBalanceComponent implements OnInit { constructor() { this.form = new FormGroup({ - date: new FormControl(new Date(), { nonNullable: true }), + date: new FormControl(moment(new Date()), { nonNullable: true }), }); } @@ -69,7 +69,7 @@ export class TrialBalanceComponent implements OnInit { this.info = data.info; this.form.setValue({ - date: moment(this.info.date, 'DD-MMM-YYYY').toDate(), + date: moment(this.info.date, 'DD-MMM-YYYY'), }); this.dataSource = new TrialBalanceDataSource(this.info.body, this.paginator, this.sort); });