Hello I have the following code:
export default class UserData {
constructor(days = {}, firstDay = getFirstDay(), lastAccessDay){
this.days = days;
this.firstDay = firstDay || getFirstDay();
this.lastAccessDay = lastAccessDay;
}
static getFirstDay() {
return new Date();
}
}
The idea was that if I don't pass a value to the constructor it would use a static method to calculate the firstDay.
The problem is that to the constructor getFirstDay() is undefined.
I'm a bit confused about what would the best way to set this up following best practices and conventions.