浏览代码

chore(utils): 添加禁止选择超过今天的日期的函数

wangcong 1 周之前
父节点
当前提交
b72dec41a4
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      src/utils/index.ts

+ 5 - 0
src/utils/index.ts

@@ -8,6 +8,7 @@ import { fetchWithTimeout } from './fetch';
 
 
 import type { SorterResult } from 'ant-design-vue/es/table/interface';
 import type { SorterResult } from 'ant-design-vue/es/table/interface';
 import type { GlobalToken } from 'ant-design-vue/es/theme';
 import type { GlobalToken } from 'ant-design-vue/es/theme';
+import type { Dayjs } from 'dayjs';
 import type { ApiResponse, PageSorts } from '@/types';
 import type { ApiResponse, PageSorts } from '@/types';
 
 
 export const request = async <T>(url: string, init: RequestInit = {}, timeout?: number): Promise<T> => {
 export const request = async <T>(url: string, init: RequestInit = {}, timeout?: number): Promise<T> => {
@@ -272,3 +273,7 @@ export const isEmptyVal = (value: unknown) => {
 export const isNotEmptyVal = (value: unknown) => {
 export const isNotEmptyVal = (value: unknown) => {
   return value !== undefined && value !== null;
   return value !== undefined && value !== null;
 };
 };
+
+export const disabledDate = (current: Dayjs) => {
+  return current > dayjs().endOf('day');
+};