google sheets – Automatic insertion of the date when a check box is ticked

I have a simple sheet that has two columns with checkboxes (columns 5 and 8). The goal is to check the box to insert the date and time in the next column. I make it work correctly with a column with the following code:

function onEdit (e) {
varCell = e.source.getActiveCell (), col = aCell.getColumn ();
if (col == 5) {
var adjacentCell = aCell.offset (0, 1);
var newDate = Utilities.formatDate (new Date (),
"GMT + 1", "dd / mm / yyyy kk: mm: ss");
adjacentCell.setValue (newDate);
}
}

For my life, I do not know how to modify it so that it also works with column 8. Any help will save me from tearing off my hair!