A question on an #AppsScripts user forum led me into an investigation into the best way to extend a class, for example a
Date class, from inside a library so that the host project can use it.
Let's suppose we want to make a class
BetterDate that extends the date object so that it automatically calculates the result of
.getTime() once. (Maybe we don't want to waste time? rimshot)
We'll add an instance method on it to calculate how many days we have to wait (until our birthday). We also need a static object
now() on it so that we can get a now date that is an instance of
This to me is most elegant: