How can I set Date object to null in Javascript?

Tags: , , ,

I am trying to set check_date to null I tried

new Date as 0, null

but none of them are working for me. How can I achieve this?


  async lastDayToLive() {
        const allDiner  = await{ where: { flight: 'L' } });
        const len = allDiner .length;
        const lastDinker = allDiner [len - 1];
        const { a,} = lastDinker;
            { flight: 'land', check_date: `${new Date(0)}` }, --------------------> Here
            { where: {a}}



You can’t set a Date to null. Date is an an embedded JavaScript type.

Setting date to new Date(0) just sets it to Unix Epoch.

You can, however, set a variable to null.

This should work:

var check_date = null;

or, in your case:

            { flight: 'land', check_date: null }, 
            { where: {a}}

Source: stackoverflow