Address code review feedback: fix Date object reuse and add clarifying comments
Co-authored-by: THoguet <61246905+THoguet@users.noreply.github.com>
This commit is contained in:
1 parent
4e7eb18bc5
commit
6061e02835
2 files changed
+8
-8
No files matched your search
@@ -19,6 +19,9 @@ export class CalendarMonth implements OnInit {
|
||||
year!: number;
|
||||
|
||||
// Cache "now" as a class property to avoid recreating it on every call
|
||||
// Note: This value is cached at component initialization and won't update if the day changes
|
||||
// while the component is still mounted. This is acceptable for this use case since the app
|
||||
// is primarily used within a single day session.
|
||||
private readonly now: Date = (() => {
|
||||
const date = new Date();
|
||||
date.setHours(0, 0, 0, 0);
|
||||
|
||||
Reference in new issue
Block a user