Optimize performance: cache dates, reduce lookups, improve algorithms

Co-authored-by: THoguet <61246905+THoguet@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]andTHoguet committed 2025-11-01 20:55:39 +00:00
1 parent d3caf86028
commit 601e7855aa
3 files changed
+116 -64

No files matched your search

@@ -18,10 +18,15 @@ export class CalendarMonth implements OnInit {
@Input({ required: true })
year!: number;
// Cache "now" as a class property to avoid recreating it on every call
private readonly now: Date = (() => {
const date = new Date();
date.setHours(0, 0, 0, 0);
return date;
})();
getNow(): Date {
const now = new Date();
now.setHours(0, 0, 0, 0);
return now;
return this.now;
}
currentMonth: Date = new Date();