This is my code that was working correctly:
import { format, parse } from "date-fns";
///irrelevant code
export class Task {
constructor(name, notes, dueDate, priority, taskId = uuidv4()) {
this.name = name;
this.notes = notes;
this.dueDate = "Due: " + format(parse(dueDate), "MM/dd/yyyy");
this.priority = priority;
this.taskId = taskId;
}
}
Now, suddenly, I’m getting an error in the console, as seen in the image.
I’ve tried reinstalling date-fns with npm and switching it to the DevDependencies in package.json
. It works fine if I just remove the format, but I’m puzzled because it was working fine earlier. I did not make any changes to anything.