How to make an auto-timestamped row in Google Sheets

I found a guide for a timestamp column that works great. But I’d like it as a header row, and cant get it to work. Attempting horozontal auto-timestamp header. Currently no effect. Would also like to figure out how to use a named range here. But just using row 1 would be good enough.

Here is my source

function onEdit(e){
const sh = e.source.getActiveSheet();
sh.getRange ('M' + e.range.rowStart)
.setValue (new Date())
.setNumberFormat ('MM/dd/yyyy HH:MMam/pm');
}

And here is my edit

function onEdit(e){
const sh = e.source.getActiveSheet();
sh.getRange ('1' + e.range.columnStart)
.setValue (new Date())
.setNumberFormat ('MM/dd/yyyy');
}

Currently does nothing. The goal is to populate row with corresponding column edit.