New answers tagged


Google Apps Script / JavaScript doesn't include a "native" way to handle durations but you could use a library like moment.js to add several methods to handle them but this could imply a steeped learning curve. A simpler solution is to read the duration from the spreadsheet as "displayed value" by using getDisplayValue instead of the "inherent value" got ...


Working with date, time and specifically duration is a pain in JavaScript, and Google Sheets does not make it much easier. A JavaScript Date object (which is really a datetime object) is not suited for working with durations. A datetime is a lot more complex than it seems at first. So when you ask Where did the "days" part of the duration go? ... ...


There is an error on elseif. The correct syntax is else if

Top 50 recent answers are included