Due date day-2

Due date day-2

wass_wasswass_wass Posts: 2Questions: 1Answers: 0
edited March 2022 in DateTime

Hello everybody,
I would like to put a color on dates whose term arrives in 2 days.
Here is what I did for a date greater than today's date.

rowCallback: function (row, data, index) {

            if (data[6] < moment().format('DD/MM/YYYY')) {
                $(row).find('td:eq(6)').css('background-color', '#f0aaaa').css('font-weight', 'bold')
            }
        },

Thank's

Answers

  • kthorngrenkthorngren Posts: 20,139Questions: 26Answers: 4,734

    Maybe use the moment.js add() method.

    Kevin

  • wass_wasswass_wass Posts: 2Questions: 1Answers: 0

    Thank's Kevin.
    So I had to substract 2 days from the columns data [6] like this
    rowCallback: function (row, data, index) {

    if (data[6] == moment(data[6]).add(-2, 'days')) {
    $(row).find('td:eq(6)').css('background-color', '#ff7f00').css('font-weight', 'bold')
    }
    },

Sign In or Register to comment.