feat(foundation): remove max expiration days check of API Token (#351)

This commit is contained in:
Evan 2025-07-31 11:18:15 +08:00 committed by GitHub
parent c4e0e27702
commit 397912fccf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 9 deletions

View File

@ -13,21 +13,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
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 {