Moved from moment to luxon.
Report Printing is not a post not a get.
This commit is contained in:
@@ -10,7 +10,7 @@ import { MatInputModule } from '@angular/material/input';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { Router } from '@angular/router';
|
||||
import moment from 'moment';
|
||||
import { DateTime } from 'luxon';
|
||||
|
||||
import { SaleCategoryService } from '../sale-category/sale-category.service';
|
||||
import { ErrorStateComponent } from '../shared/error-state/error-state.component';
|
||||
@@ -21,8 +21,8 @@ import { BeerSaleReport } from './beer-sale-report';
|
||||
import { BeerSaleReportService } from './beer-sale-report.service';
|
||||
|
||||
export interface BeerSaleReportFormData {
|
||||
startDate: Date;
|
||||
finishDate: Date;
|
||||
startDate: DateTime;
|
||||
finishDate: DateTime;
|
||||
saleCategory: string;
|
||||
regular: boolean;
|
||||
happy: boolean;
|
||||
@@ -81,8 +81,8 @@ export class BeerSaleReportComponent {
|
||||
computation: (info): BeerSaleReportFormData => {
|
||||
if (info) {
|
||||
return {
|
||||
startDate: moment(info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
finishDate: moment(info.finishDate, 'DD-MMM-YYYY').toDate(),
|
||||
startDate: DateTime.fromFormat(info.startDate, 'dd-MMM-yyyy'),
|
||||
finishDate: DateTime.fromFormat(info.finishDate, 'dd-MMM-yyyy'),
|
||||
saleCategory: info.saleCategory?.id ?? '',
|
||||
regular: info.regular,
|
||||
happy: info.happy,
|
||||
@@ -91,8 +91,8 @@ export class BeerSaleReportComponent {
|
||||
};
|
||||
}
|
||||
return {
|
||||
startDate: new Date(),
|
||||
finishDate: new Date(),
|
||||
startDate: DateTime.now(),
|
||||
finishDate: DateTime.now(),
|
||||
saleCategory: '',
|
||||
regular: true,
|
||||
happy: true,
|
||||
@@ -131,8 +131,8 @@ export class BeerSaleReportComponent {
|
||||
const formModel = this.formModel();
|
||||
|
||||
return new BeerSaleReport({
|
||||
startDate: moment(formModel.startDate).format('DD-MMM-YYYY'),
|
||||
finishDate: moment(formModel.finishDate).format('DD-MMM-YYYY'),
|
||||
startDate: formModel.startDate.toFormat('dd-MMM-yyyy'),
|
||||
finishDate: formModel.finishDate.toFormat('dd-MMM-yyyy'),
|
||||
saleCategory: this.saleCategories().find((sc) => sc.id === formModel.saleCategory),
|
||||
regular: formModel.regular,
|
||||
happy: formModel.happy,
|
||||
|
||||
Reference in New Issue
Block a user