Skip to content

Commit c450f00

Browse files
committed
feat(@142vip/utils): 基于原生ConfigType优化VipDayjs类函数的类型
1 parent d59f806 commit c450f00

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/utils/src/pkgs/dayjs.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import dayjs from 'dayjs'
1+
import dayjs, { ConfigType } from 'dayjs'
22

33
export class VipDayjs {
44
/**
@@ -24,22 +24,22 @@ export class VipDayjs {
2424
* 是否在当前时间之前
2525
* @param date
2626
*/
27-
public isBeforeNow(date: Date): boolean {
27+
public isBeforeNow(date?: ConfigType): boolean {
2828
return dayjs().isBefore(dayjs(date))
2929
}
3030

3131
/**
3232
* 是否在当前时间之后
3333
* @param date
3434
*/
35-
public isAfterNow(date: Date): boolean {
35+
public isAfterNow(date?: ConfigType): boolean {
3636
return dayjs().isAfter(dayjs(date))
3737
}
3838

3939
/**
4040
* 时间格式化,默认: 年-月-日 时:分:秒
4141
*/
42-
public formatDateToStr(date: Date, template?: string): string {
42+
public formatDateToStr(date: ConfigType, template?: string): string {
4343
return dayjs(date).format(template ?? this.FORMAT_TEMPLATE_STR)
4444
}
4545

0 commit comments

Comments
 (0)