Error in loading dashboard reports when using moment-jalaali.js

Continuing the discussion from How to properly display jalali dates for Persian language:

As mentioned above, we added the moment-jalaali script to the theme and changed the date display formats in the site’s text settings.

    <script src=""></script>

By doing this, the problem of displaying the date in Hijri Shamsi was solved. But after adding the script, the dashboard reports will fail and the following error will occur.

Uncaught TypeError: Cannot read property 'split' of null

And when we debug, this error is observed.


I guess I would class this either as #support or #feature request.

You are looking for a supported way of adding jalaali, there is no official supported way. What we have is a hack.

It is unclear if you have a version match or not.

I do support making this some sort of proper official version or proper official component.

One complication is that we are looking to move off moment longer term.


Thanks Sam,
Yes, you are right, #support is right here. If this is officially supported, that’s great.
I just asked here because maybe the Discourse team would know better where the problem came from and guide me. Strange that this problem occurs! Apart from this and another case, this solution works correctly one-way (show only). We use the latest version of Discourse.

Step one is to make sure this script you are hacking in is from the exact same moment.js release we are using in core. Can you confirm that?

We are using version 0.9.2 of the script. This version works based on the following dependencies:

  "devDependencies": {
    "chai": "^4.2.0",
    "eslint": "^6.7.1",
    "mocha": "^5.2.0"
  "dependencies": {
    "jalaali-js": "^1.1.0",
    "moment": "^2.22.2",
    "moment-timezone": "^0.5.21",
    "rimraf": "^2.6.2"