feat: date range status function added
This commit is contained in:
parent
8a941d0d14
commit
02e4e58f19
3 changed files with 18 additions and 34 deletions
|
|
@ -88,3 +88,17 @@ export const timeAgo = (time: any) => {
|
|||
}
|
||||
return time;
|
||||
};
|
||||
|
||||
export const getDateRangeStatus = (startDate: string , endDate: string ) => {
|
||||
const now = new Date();
|
||||
const start = new Date(startDate);
|
||||
const end = new Date(endDate);
|
||||
|
||||
if (end < now) {
|
||||
return "past";
|
||||
} else if (start <= now && end >= now) {
|
||||
return "current";
|
||||
} else {
|
||||
return "upcoming";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue