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:
parent
6bbf2d8adb
commit
a86a736340
6 changed files with 69 additions and 77 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue