moment / moment-timezone

Timezone support for moment.js
momentjs.com/timezone
MIT License
3.82k stars 835 forks source link

Incorrect UTF characters in: date.js and date.min.js #1065

Closed CaptainTomBln closed 1 year ago

CaptainTomBln commented 1 year ago

Environment

For bug reports, please run the following code in your environment and include the output:

console.log({
  moment: moment.version,
  momentTz: moment.tz.version,
  date: (new Date()).toString(),
  intlZone: new Intl.DateTimeFormat().resolvedOptions().timeZone,
});

Issue description

Hi there,

I am running three WP websites and I have to deal with many hacker attacks, So I installed the Anti-Malware plugin that works properly. But there are two files that cannot be scanned: date.js and date.min.js. Also my editor doesn't load them, complaining that there are some wrong UTF characters included into the file. This is the same with all three websites. Using MS Word and saving the files again with the option "allow changing characters" I could make them readably by my editor as well as by the anti-malware scanner. But I am not sure if I didn't change anything important in those huge resources.

So I would like to propose that you find the problem in your source files and provide them with WP in a correct format. My editor is PSPad, if this helps you to identify the problem.

Thanks, Thomas

gilmoreorless commented 1 year ago

Hi, this project is not associated with Wordpress, and doesn't produce any files called date.js or date.min.js. My guess is that there is a separate project/plugin that includes this library, and that's what's adding the invalid characters.

To double-check this, try loading just a file produced by this project and see if the problem remains. Here are some examples:

CaptainTomBln commented 1 year ago

Dear Gilmore, thank you very much for your reply. In both files I found the following: //! version : 0.5.40 //! Copyright (c) JS Foundation and other contributors //! license : MIT //! github.com/moment/moment-timezone The fourth line is pointing to this page. The path of the two files is /wp-includes/js/dist/. I'm wondering if any plugin may write into /wp-includes/? In the code I also find an error message referring to https://momentjs.com/timezone/docs/. There I find a link to this Github Page. Since the files refer to momentjs I will try to find some contact there. Thanks, Thomas

gilmoreorless commented 1 year ago

I downloaded a fresh copy of Wordpress to take a look. Yes, the date.js file includes both the moment and moment-timezone libraries, which are both part of the Moment group of projects (so raising a separate ticket for momentjs.com doesn't add anything). But the process that includes them in Wordpress is handled entirely by Wordpress, not this group.

Did you try opening either of the links I posted in my first reply?

I also suggest you download a fresh copy of Wordpress from https://wordpress.org/download/ and open the same date.js file in your editor. If that doesn't have a problem, then something else is corrupting your project, and it isn't caused by the source code in these libraries.

As for whether something else is writing to wp-includes, I have to repeat: This project is not associated with Wordpress in any way. We can't and won't provide support for unrelated software.

CaptainTomBln commented 1 year ago

Dear Gilmore, thank you very much for your explanation and your hint to download that latest version of WP (sorry for not seeing this way in my confusion). Your expectation was right: The files in WP are okay. Something else must have corrupted my files. Thomas

sslincoco commented 1 year ago

您的邮件已收到,我会尽快给您回复。