Skip to content

Commit e8df343

Browse files
FIXED: months labels
1 parent 5f799ab commit e8df343

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/utils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,9 @@ export const getMonthLabel = (startDate: string): string => {
233233
const start = new Date(startDate);
234234
const now = new Date();
235235

236-
const currentMonthStart = new Date(now.getFullYear(), now.getMonth(), 1);
237236
const inputMonthStart = new Date(start.getFullYear(), start.getMonth(), 1);
238237

239-
const diffTime = currentMonthStart.getTime() - inputMonthStart.getTime();
240-
const diffMonths = Math.floor(diffTime / (30 * 24 * 60 * 60 * 1000));
238+
const diffMonths = (now.getFullYear() - start.getFullYear()) * 12 + (now.getMonth() - start.getMonth());
241239

242240
if (diffMonths === 0) {
243241
return "this month";

0 commit comments

Comments
 (0)