getDate() function not working anymore?

I don’t see a problem except for the {} that you forgot to comment out.
Try to add console.log() 's to locate the problem.