0a33497d40
Initial commit of the Super-Admin web panel (Next.js + TypeScript). CI admin-web-check job was failing because the directory was never tracked in git. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31 lines
994 B
TypeScript
31 lines
994 B
TypeScript
import { format } from "date-fns-jalali";
|
|
import { enUS } from "date-fns-jalali/locale/en-US";
|
|
import { faIR } from "date-fns-jalali/locale/fa-IR";
|
|
|
|
const PLAN_TIERS = ["Free", "Pro", "Business", "Enterprise"] as const;
|
|
export type PlanTierKey = (typeof PLAN_TIERS)[number];
|
|
|
|
export function isPlanTierKey(tier: string): tier is PlanTierKey {
|
|
return (PLAN_TIERS as readonly string[]).includes(tier);
|
|
}
|
|
|
|
export function numberLocaleForUi(locale: string): string {
|
|
if (locale === "en") return "en-US";
|
|
if (locale === "ar") return "ar-SA";
|
|
return "fa-IR";
|
|
}
|
|
|
|
export function formatHeaderTime(date: Date, locale: string): string {
|
|
return date.toLocaleTimeString(numberLocaleForUi(locale), {
|
|
hour: "2-digit",
|
|
minute: "2-digit",
|
|
second: "2-digit",
|
|
hour12: false,
|
|
});
|
|
}
|
|
|
|
export function formatHeaderJalaliDate(date: Date, locale: string): string {
|
|
const jalaliLocale = locale === "en" ? enUS : faIR;
|
|
return format(date, "EEEE d MMMM yyyy", { locale: jalaliLocale });
|
|
}
|