Skip to main content

not support Intl


ReferenceError: ‘Intl’ is not defined


const formatter = new Intl.DateTimeFormat('en-US', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: 'numeric',
hour12: false,
minute: 'numeric',
timeZone: 'Asia/Shanghai',
});
const expiredAtDate = new Date(expiredAt)
expiredAtText = formatter.format(expiredAtDate);

If you are using a script file and receive the error message “Uncaught ReferenceError: Intl is not defined,” it means that ‘Intl’ is either a variable or a method that you are attempting to use before declaring it using the var keyword. This error indicates that there is a reference to a non-existent variable somewhere in the code. To fix this error, you need to declare the variable or ensure that it is available in the current script or scope. If the variable is not available, it may indicate that the library is not loaded, and JavaScript does not recognize ‘Intl’.


To solve this error: Load your library at the beginning of all your scripts.


There can be multiple other reasons for this issue:



  • Conflict with Other Libraries

  • Path to your library included is not correct

  • Llibrary file is corrupted

  • Working offline (when you use CDN)


I also have this problem.


Reply