Admin and Gallery and event change
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
// Date helpers shared by the site and the admin panel (no server-only imports).
|
||||
import type { MeetingItem } from "./content";
|
||||
|
||||
/** Today's date in India as YYYY-MM-DD. */
|
||||
export function todayIST() {
|
||||
return new Date().toLocaleDateString("en-CA", { timeZone: "Asia/Kolkata" });
|
||||
}
|
||||
|
||||
/** The next meeting on or after today, if any. */
|
||||
export function getNextMeeting(list: MeetingItem[]): MeetingItem | undefined {
|
||||
const today = todayIST();
|
||||
return [...list].filter((m) => m.date >= today).sort((a, b) => a.date.localeCompare(b.date))[0];
|
||||
}
|
||||
|
||||
export function formatMeetingDate(date: string) {
|
||||
const [y, m, d] = date.split("-").map(Number);
|
||||
return new Date(Date.UTC(y, m - 1, d)).toLocaleDateString("en-IN", {
|
||||
weekday: "short",
|
||||
day: "numeric",
|
||||
month: "short",
|
||||
year: "numeric",
|
||||
timeZone: "UTC",
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user