chore: cycles loading, fix: cycles favorite mutation (#379)

This commit is contained in:
Aaryan Khandelwal
2023-03-07 11:04:51 +05:30
committed by GitHub
parent b54a1f221f
commit 64978969a0
10 changed files with 206 additions and 132 deletions

View File

@@ -89,7 +89,9 @@ export const timeAgo = (time: any) => {
return time;
};
export const getDateRangeStatus = (startDate: string , endDate: string ) => {
export const getDateRangeStatus = (startDate: string | null, endDate: string | null) => {
if (!startDate || !endDate) return "draft";
const now = new Date();
const start = new Date(startDate);
const end = new Date(endDate);
@@ -101,12 +103,25 @@ export const getDateRangeStatus = (startDate: string , endDate: string ) => {
} else {
return "upcoming";
}
}
};
export const renderShortDateWithYearFormat = (date: Date) => {
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const months = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
];
const day = date.getDate();
const month = months[date.getMonth()];
const year = date.getFullYear();
return isNaN(date.getTime()) ? "N/A" : ` ${month} ${day}, ${year}`;
}
return isNaN(date.getTime()) ? "N/A" : ` ${month} ${day}, ${year}`;
};