fix: cycle stats empty state (#1338)

* chore: active cycle percentage fix

* fix: progress chart x-axis values
This commit is contained in:
Aaryan Khandelwal 2023-06-23 11:09:34 +05:30 committed by GitHub
parent 9c85704be3
commit d3c56c1765
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 211 additions and 165 deletions

View file

@ -25,13 +25,18 @@ export const findHowManyDaysLeft = (date: string | Date) => {
return Math.ceil(timeDiff / (1000 * 3600 * 24));
};
export const getDatesInRange = (startDate: Date, endDate: Date) => {
export const getDatesInRange = (startDate: string | Date, endDate: string | Date) => {
startDate = new Date(startDate);
endDate = new Date(endDate);
const date = new Date(startDate.getTime());
const dates = [];
while (date <= endDate) {
dates.push(new Date(date));
date.setDate(date.getDate() + 1);
}
return dates;
};