diff --git a/src/frontend/package.json b/src/frontend/package.json index 07d4d115f..be4dff1a5 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -35,6 +35,7 @@ "echarts": "^4.0.4", "jquery": "^3.3.1", "js-yaml": "^3.12.0", + "moment": "^2.22.2", "mutationobserver-shim": "^0.3.2", "ngx-markdown": "^6.3.0", "particlesjs": "^2.2.3", diff --git a/src/frontend/src/app/admin/reportform/deploy/deploy.component.html b/src/frontend/src/app/admin/reportform/deploy/deploy.component.html index 44e750142..f45e23b24 100644 --- a/src/frontend/src/app/admin/reportform/deploy/deploy.component.html +++ b/src/frontend/src/app/admin/reportform/deploy/deploy.component.html @@ -28,7 +28,7 @@

上线次数统计

{{i}} - {{data.date | date:'yyyy-MM-dd'}} + {{data.date | date:'MM-dd-yyyy'}} {{data.count}} diff --git a/src/frontend/src/app/admin/reportform/deploy/deploy.component.ts b/src/frontend/src/app/admin/reportform/deploy/deploy.component.ts index 819e9000a..89759a581 100644 --- a/src/frontend/src/app/admin/reportform/deploy/deploy.component.ts +++ b/src/frontend/src/app/admin/reportform/deploy/deploy.component.ts @@ -3,6 +3,7 @@ import {BreadcrumbService} from '../../../shared/client/v1/breadcrumb.service'; import {MessageHandlerService} from '../../../shared/message-handler/message-handler.service'; import {PublishService} from '../../../shared/client/v1/publish.service'; import {State} from '@clr/angular'; +import * as moment from "moment"; @Component({ selector: 'wayne-deploy', @@ -23,17 +24,10 @@ export class DeployComponent implements OnInit { ngOnInit() { const now = new Date(); - this.startTime = this.formatDate(new Date(now.getTime() - 1000 * 3600 * 24 * 7)); - this.endTime = this.formatDate(now); - } - - formatDate(time: Date) { - const year: number = time.getFullYear(); - const month: any = (time.getMonth() + 1) < 10 ? '0' + (time.getMonth() + 1) : (time.getMonth() + 1); - const day: any = time.getDate() < 10 ? '0' + time.getDate() : time.getDate(); - return year + '-' + month + '-' + day; - }; + this.startTime = moment(new Date(now.getTime() - 1000 * 3600 * 24 * 7)).format("MM/DD/YYYY"); + this.endTime = moment(now).format("MM/DD/YYYY"); + } search() { this.refresh(); @@ -43,7 +37,7 @@ export class DeployComponent implements OnInit { } refresh(state?: State) { - this.publishService.getDeployStatistics(this.startTime + 'T00:00:00Z', this.endTime + 'T00:00:00Z').subscribe( + this.publishService.getDeployStatistics(moment(this.startTime).format("YYYY-MM-DDTHH:mm:SS")+'Z', moment(this.endTime).format("YYYY-MM-DDTHH:mm:SS")+'Z').subscribe( resp => { this.datas = resp.data; },