Yesterday, I discovered following:
- You create a new Date object DO in a function F1 located in the script project of a spreadsheet S
- Then you call a different function F2 with DO as an argument to process this date located in a separate script library L (not attached to any spreadsheet)
- The DO is not a Date object anymore when it enters the F2 function of L. To my surprise, a test like DO instanceof Date fails.
I have tried all kinds of ways to inspect the transferred object DO, but I was not able to determine how exactly this object is modified by Google Apps Script during this transfer or whether it is a general Javascript issue when transferring objects between scripts.
If Date object is indeed modified in some way while in transfer between two separate scripts, why is the Date object not reconstituted after arrival? In my opinion, this would be the correct way of doing it!
However, I was able to create a new valid Date object from the transferred object DO inside of F2.
No comments:
Post a Comment