Can somebody help me fix this js code please

Here is the code, it appears to be broken, Iwant to use it in shopify…

<script type="text/javascript">

      // get the destination within the DOM
  var wrapper = document.getElementById('productEta'),
      
      // get today as a js Date object
      today = new Date(),

      // get the Unix of today (miliseconds) and add desired time (3 weeks)
      etaUnix = today.getTime() + (60 * 60 * 24 * 11 * 1000),

      // convert the new time to date object and then to a human readable string
      etaForHumans = new Date(etaUnix).toDateString();

  // set the destination inner html to be what it already is
  // plus a space and the human readable string.
  wrapper.innerHTML += ' ' + etaForHumans;

</script>

I ran it via codepen and I get errors…

ran it in codepen just now and it’s working fine, can you explain the error?

also make sure you have an id selector ie: <div id="productEta"></div> in your html

If by saying the code appears to be broken, do you mean that it doesn’t give the current date? If so, just get rid of + (60 * 60 * 24 * 11 * 1000).

etaUnix = today.getTime()

Also, were you hoping to separate the displayed values with commas? I ask because you have three statements with trailing commas.

 var wrapper = document.getElementById('productEta'),
      
      // get today as a js Date object
      today = new Date(),

      // get the Unix of today (miliseconds) and add desired time (3 weeks)
      etaUnix = today.getTime() + (60 * 60 * 24 * 11 * 1000),

If so, you’ll need to put the commas between quote marks. For example, ", "

I ran it in codepend with script at the beggining and the end…sorry guys…it works now…
thank you for such quick help

I will post again when I will have js questions