feat(foundation): remove max expiration days check of API Token (#351)
This commit is contained in:
@@ -17,17 +17,10 @@
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { I18n, type I18nKeysNoOptionsType } from '@coze-arch/i18n';
|
import { I18n, type I18nKeysNoOptionsType } from '@coze-arch/i18n';
|
||||||
|
|
||||||
const MAX_EXPIRATION_DAYS = 30;
|
|
||||||
// 1-30 days valid period
|
|
||||||
export const disabledDate = (date?: Date) => {
|
export const disabledDate = (date?: Date) => {
|
||||||
const today = dayjs().startOf('day'); // Start time of the day
|
const today = dayjs().startOf('day'); // Start time of the day
|
||||||
const thirtyDaysLater = today.add(MAX_EXPIRATION_DAYS, 'day'); // Date in 30 days
|
|
||||||
|
|
||||||
return (
|
return dayjs(date).isBefore(today, 'day') || dayjs(date).isSame(today, 'day');
|
||||||
dayjs(date).isBefore(today, 'day') ||
|
|
||||||
dayjs(date).isSame(today, 'day') ||
|
|
||||||
dayjs(date).isAfter(thirtyDaysLater, 'day')
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export enum ExpirationDate {
|
export enum ExpirationDate {
|
||||||
|
|||||||
Reference in New Issue
Block a user