passing a date object to a google app script function
13:32 06 Dec 2025

This seems weird.

I have a cell a1: containing [Jan 1, 1984].

I have a function xxx

function xxx(d) {
  return d;
}

if I try this in a cell like

=xxx(a1)

that returns 1 no matter what the year is.

if on the other hand I put this in the cell =datevalue(a1) i get back 30682

it seems like google sheets is passing the day-of-the-year to the appscript function. That seems very weird.

google-apps-script