Refactors date handling to use DateService

Standardizes date manipulation across the application by leveraging the DateService.
This change improves consistency and reduces code duplication by removing redundant date calculations.
This commit is contained in:
Janus C. H. Knudsen 2025-10-03 20:59:52 +02:00
parent 6bbf2d8adb
commit a86a736340
6 changed files with 69 additions and 77 deletions

View file

@ -20,6 +20,7 @@ import {
startOfWeek,
endOfWeek,
addWeeks,
addMonths,
isSameDay,
getISOWeek
} from 'date-fns';
@ -257,6 +258,16 @@ export class DateService {
public addWeeks(date: Date, weeks: number): Date {
return addWeeks(date, weeks);
}
/**
* Add months to a date
* @param date - Base date
* @param months - Number of months to add (can be negative)
* @returns New date
*/
public addMonths(date: Date, months: number): Date {
return addMonths(date, months);
}
/**
* Get ISO week number (1-53)