From c450f0048f4ae05e798f00edf2455bb429478729 Mon Sep 17 00:00:00 2001 From: chufan Date: Mon, 10 Nov 2025 15:08:13 +0800 Subject: [PATCH] =?UTF-8?q?feat(@142vip/utils):=20=E5=9F=BA=E4=BA=8E?= =?UTF-8?q?=E5=8E=9F=E7=94=9F`ConfigType`=E4=BC=98=E5=8C=96`VipDayjs`?= =?UTF-8?q?=E7=B1=BB=E5=87=BD=E6=95=B0=E7=9A=84=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/utils/src/pkgs/dayjs.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/utils/src/pkgs/dayjs.ts b/packages/utils/src/pkgs/dayjs.ts index 5d790cd6..064711b6 100644 --- a/packages/utils/src/pkgs/dayjs.ts +++ b/packages/utils/src/pkgs/dayjs.ts @@ -1,4 +1,4 @@ -import dayjs from 'dayjs' +import dayjs, { ConfigType } from 'dayjs' export class VipDayjs { /** @@ -24,7 +24,7 @@ export class VipDayjs { * 是否在当前时间之前 * @param date */ - public isBeforeNow(date: Date): boolean { + public isBeforeNow(date?: ConfigType): boolean { return dayjs().isBefore(dayjs(date)) } @@ -32,14 +32,14 @@ export class VipDayjs { * 是否在当前时间之后 * @param date */ - public isAfterNow(date: Date): boolean { + public isAfterNow(date?: ConfigType): boolean { return dayjs().isAfter(dayjs(date)) } /** * 时间格式化,默认: 年-月-日 时:分:秒 */ - public formatDateToStr(date: Date, template?: string): string { + public formatDateToStr(date: ConfigType, template?: string): string { return dayjs(date).format(template ?? this.FORMAT_TEMPLATE_STR) }