turkmentv_front/lib/actions.ts

16 lines
338 B
TypeScript

"use server";
export async function getLotteryStatus(startTime: string, endTime: string) {
const now = new Date();
const start = new Date(startTime);
const end = new Date(endTime);
if (now < start) {
return "Upcoming";
} else if (now >= start && now <= end) {
return "Ongoing";
} else {
return "Finished";
}
}