From 470586b5f534700c72e8777eb2ccddd5b71a6641 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 17 Jul 2024 10:49:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order-oil-list.component.html | 2 +- .../order-oil-list/order-oil-list.component.ts | 4 +++- src/app/pipes/common/date-minutes-diff.pipe.ts | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 src/app/pipes/common/date-minutes-diff.pipe.ts diff --git a/src/app/pages/trade/order-oil-list/order-oil-list.component.html b/src/app/pages/trade/order-oil-list/order-oil-list.component.html index 1a8f52c..b776ff3 100644 --- a/src/app/pages/trade/order-oil-list/order-oil-list.component.html +++ b/src/app/pages/trade/order-oil-list/order-oil-list.component.html @@ -228,7 +228,7 @@ diff --git a/src/app/pages/trade/order-oil-list/order-oil-list.component.ts b/src/app/pages/trade/order-oil-list/order-oil-list.component.ts index 895e84b..e4168fa 100644 --- a/src/app/pages/trade/order-oil-list/order-oil-list.component.ts +++ b/src/app/pages/trade/order-oil-list/order-oil-list.component.ts @@ -38,6 +38,7 @@ import {NzBadgeComponent} from "ng-zorro-antd/badge"; import {ButtonPipe} from "../../../pipes/common/button.pipe"; import {NzTooltipDirective} from "ng-zorro-antd/tooltip"; import {symlinkSync} from "fs"; +import {DateMinutesDiffPipe} from "../../../pipes/common/date-minutes-diff.pipe"; @Component({ selector: 'app-order-oil-list', @@ -86,6 +87,7 @@ import {symlinkSync} from "fs"; NzTimelineComponent, NzBadgeComponent, NzTooltipDirective, + DateMinutesDiffPipe ], templateUrl: './order-oil-list.component.html', styleUrl: './order-oil-list.component.less' @@ -397,5 +399,5 @@ export class OrderOilListComponent { }) } - + protected readonly Date = Date; } diff --git a/src/app/pipes/common/date-minutes-diff.pipe.ts b/src/app/pipes/common/date-minutes-diff.pipe.ts new file mode 100644 index 0000000..f3f4e84 --- /dev/null +++ b/src/app/pipes/common/date-minutes-diff.pipe.ts @@ -0,0 +1,18 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'dateMinutesDiff', + standalone: true +}) +/** + * 时间分钟差异 + */ +export class DateMinutesDiffPipe implements PipeTransform { + + + transform(newTime: number | Date, olbTime: number | Date): number { + var diffTimeStamp = new Date().getTime() - new Date(olbTime).getTime(); + return parseInt(String(diffTimeStamp / (1000 * 60))); + } + +}