Uncaught ReferenceError: DateFormatter is not defined
-
Our browser console is showing the following error on all pages that load events:
Uncaught ReferenceError: DateFormatter is not definedClick here for details.
Affected files:
/wp-content/plugins/the-events-calendar/src/resources/js/events-dynamic.js/wp-content/plugins/the-events-calendar/src/resources/js/events-dynamic.min.jsClick here for details.
We deactivated all plugins except core plugins and TEC, but the problem persists. We’re using WP 5.5.1, TEC 5.1.6, and PHP 7.3.16
What’s going on? We need a fix.
Help appreciated. Thank you!
-
Hi @jetxpert,
Thanks for writing in,From what I see in the console, you seem to be missing this file in your site> wp-content/plugins/the-events-calendar/vendor/php-date-formatter/js/php-date-formatter.min.js
Could you have a look and let me know if that’s the case?
Best
SantiagoHi @sjaure,
Thank you for your assistance. Truly appreciated.
We have that file in our website, and it’s loading properly.
We use “Perfmatters” — a script management plugin — and have made sure the file you mentioned is not blocked or dequeued. Click here and here for details.
The funny thing is that now we’re getting a different console error on the same events pages (we didn’t change anything). Click here and here for details.
The console error message is:
Uncaught SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse (<anonymous>) at events-dynamic.min.js:1 at events-dynamic.min.js:1In any case, we checked our website in detail and found that the above errors are not causing any known or perceptible issues with our Events pages. We also checked the “net” for an explanation and found none related to this topic.
If you’d like to help pursue this with your developers to help explain the errors and/or provide a fix, that would be great. Otherwise, consider this a “beware” topic for the community.
Update:
Latest error reported above was replaced with the original, DateFormatter error we originally reported. This happened after we cleared our browser’s cache using localStorage.clear
So … we’re back to the original issue.
To assist you further, we queried again the script giving the error and this is what we found.
So, it appears the file that is causing the problem is: (above code is contained in this file)
wp-content/plugins/the-events-calendar/src/resources/js/events-dynamic.min.jsCan you ask your developers to revisit the file’s code to see if there’s an issue with it? (e.g., punctuation, spacing, etc.)
Thank you!
Hi @jetxpert
Thanks for providing us with that information.
Have you tried this out with a bare install of a default WordPress theme like Twenty Twenty and no other plugins installed besides The Events Calendar?
Let me know!
Thanks,
JaimeThanks for helping. Yes, did that. Same error.
Again, as stated above, it appears the problem lies with the file:
wp-content/plugins/the-events-calendar/src/resources/js/events-dynamic.min.jsThe function, “DateFormatter”, is either not defined or improperly defined. Not a coder, so wouldn’t know.
The error has not impacted our calendar displays, but still something worth looking into (could impact future website performance)
Hoping you can ask your developers to revisit the offending file for errors or format.
Thank you.
Hi @jetxpert
Thanks for your response. I will have our developers look into this issue.
Have a wonderful day!
Thanks,
JaimeThank you! When they look at the file, please make sure they also look at the “help” vs “helper” code lines. Shouldn’t it be just “help” throughout the file? Code lines are using a combination of both.
Click here for details.
Again, thank you.
Any updates on this?
We are not experiencing any apparent functionality issues with your plugin, but it would certainly help if one of your “gurus” can look at this and confirm the issues.
Thank you!
Hi @jetxpert
Thanks for letting me know. I don’t quite have an update here because I haven’t been able to confirm the issue on our local site.
Can you try updating to the most recent version of the plugin and let me know if the issue is still occurring?
Can you also provide me with your system information?
https://theeventscalendar.com/knowledgebase/k/sharing-your-system-information/Thanks,
JaimeThank you.
Yes, we’ve updated our website to TEC 5.2.1. Still experiencing the DateFormatter issue as described above.
We’ll share our system info if we run into a performance or functional issue caused by the DateFormatter error.
Meanwhile, would be great if your developers can look at the files listed below and confirm that the DateFormatter function is properly defined. Not a coder but, by comparison with other files, it appears it’s not.
My assumption is your seasoned developers can glance at the files and spot the error (if any) pretty quick.
Thank you!
/wp-content/plugins/the-events-calendar/src/resources/js/events-dynamic.js/wp-content/plugins/the-events-calendar/src/resources/js/events-dynamic.min.jsHi @jetxpert
Thanks for your response. Can you send me a link to your site so I can see the error in your console?
I’m trying to see if this is something occurring on all sites or is an isolated incident.
Thanks,
JaimeThere’s been no movement on this ticket for more than a week, so I’m going to close it as resolved.
If you still need assistance with this, please open a new ticket and we’ll be happy to help.
Cheers,
Eugene.If you are using any script file and getting “Uncaught ReferenceError:” which means ‘x’ is either a variable or a method which you are trying to use before declaring it using var keyword. This means that there is a non-existent variable referenced somewhere. This variable needs to be declared, or you need to make sure it is available in your current script or scope otherwise , it will endup throwing this ‘x’ is not defined error . This usually indicates that your library is not loaded and JavaScript does not recognize the ‘x’.
To solve this error: Load your library at the beginning of all your scripts.
There can be multiple other reasons for this issue:
**Path to CDN library you included is not correct
**The library file is corrupted
**Working offline
**Conflict with Other Libraries
The topic ‘Uncaught ReferenceError: DateFormatter is not defined’ is closed to new replies.