chore: merge admin repo history into monorepo at admin/
git-subtree-dir: admin git-subtree-mainline:35f5084005git-subtree-split:9f1eccd2f7
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { clsx, type ClassValue } from "clsx";
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return clsx(inputs);
|
||||
}
|
||||
|
||||
export function calcAge(birthDate?: string): number | null {
|
||||
if (!birthDate) return null;
|
||||
const b = new Date(birthDate);
|
||||
if (Number.isNaN(b.getTime())) return null;
|
||||
const now = new Date();
|
||||
let age = now.getFullYear() - b.getFullYear();
|
||||
const m = now.getMonth() - b.getMonth();
|
||||
if (m < 0 || (m === 0 && now.getDate() < b.getDate())) age--;
|
||||
return age;
|
||||
}
|
||||
Reference in New Issue
Block a user