Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

574 B
Raw Blame
import type { TOptions } from 'i18next';
import type { TranslationKeys } from '~/hooks';

type Localize = (phraseKey: TranslationKeys, options?: TOptions) => string;

export function formatKeyExpiryLabel(localize: Localize, expiry: string, hour12?: boolean): string {
  const formattedExpiry = new Date(expiry).toLocaleString(undefined, { hour12 });
  const localizedLabel = localize('com_endpoint_config_key_encryption', {
    0: formattedExpiry,
  });

  return localizedLabel.includes(formattedExpiry)
    ? localizedLabel
    : `${localizedLabel} ${formattedExpiry}`;
}