[STALE] Scripts execute maybe a error

I have met a script execute error.
scheme

{
            "name": "publishedAt",
            "properties": {
                "isRequired": false,
                "isRequiredOnPublish": false,
                "isHalfWidth": false,
                "fieldType": "DateTime",
                "editor": "DateTime"
            },
            "isLocked": false,
            "isHidden": false,
            "isDisabled": true,
            "partitioning": "invariant"
        }

change script


            var data = ctx.data;
            
            if (data.publishedAt.iv === null && ctx.status === "Published") {
                data.publishedAt.iv = new Date().toISOString().split('.')[0]+"Z";
                
                replace(data);
            }

create a new post and publish to test, but assign the value of publishedAt in the final.

    "data": {
        "title": {
            "iv": "test"
        },
        "bio": {
            "iv": null
        },
        "body": {
            "iv": null
        },
        "nutrition": {
            "iv": []
        },
        "publishedAt": {
            "iv": null
        },
        "slug": {
            "iv": "test"
        }
    }

I’m submitting a…

  • Regression (a behavior that stopped working in a new release)
  • Bug report
  • Performance issue
  • Documentation issue or request

Current behavior

Expected behavior

Minimal reproduction of the problem

Environment

  • Self hosted with docker
  • Self hosted with IIS
  • Self hosted with other version
  • Cloud version

Version: current cloud version

Browser:

  • Chrome (desktop)
  • Chrome (Android)
  • Chrome (iOS)
  • Firefox
  • Safari (desktop)
  • Safari (iOS)
  • IE
  • Edge

When I use the below change script, it works well.


            var data = ctx.data;
            
            if (data.publishedAt.iv == null && ctx.status === "Published") {
                data.publishedAt.iv = new Date().toISOString().split('.')[0]+"Z";
                
                replace(data);
            }

This shows that '===′ does not seem to work properly.

Where is the difference?

Here strict equality (===).

Are you sure it is null and not just undefined?