forked from github/plane
fix: cycle status bug fix (#656)
This commit is contained in:
parent
f074f9f003
commit
afd7741d0c
@ -92,16 +92,17 @@ export const timeAgo = (time: any) => {
|
|||||||
export const getDateRangeStatus = (startDate: string | null, endDate: string | null) => {
|
export const getDateRangeStatus = (startDate: string | null, endDate: string | null) => {
|
||||||
if (!startDate || !endDate) return "draft";
|
if (!startDate || !endDate) return "draft";
|
||||||
|
|
||||||
const now = new Date();
|
const today = renderDateFormat(new Date());
|
||||||
|
const now = new Date(today);
|
||||||
const start = new Date(startDate);
|
const start = new Date(startDate);
|
||||||
const end = new Date(endDate);
|
const end = new Date(endDate);
|
||||||
|
|
||||||
if (end < now) {
|
if (start <= now && end >= now) {
|
||||||
return "completed";
|
|
||||||
} else if (start <= now && end >= now) {
|
|
||||||
return "current";
|
return "current";
|
||||||
} else {
|
} else if (start > now) {
|
||||||
return "upcoming";
|
return "upcoming";
|
||||||
|
} else {
|
||||||
|
return "completed";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -170,4 +171,5 @@ export const renderShortTime = (date: string | Date) => {
|
|||||||
return hours + ":" + minutes;
|
return hours + ":" + minutes;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const isDateRangeValid = (startDate: string, endDate: string)=> new Date(startDate) < new Date(endDate);
|
export const isDateRangeValid = (startDate: string, endDate: string) =>
|
||||||
|
new Date(startDate) < new Date(endDate);
|
||||||
|
Loading…
Reference in New Issue
Block a user