hebcal/hebcal-js

Google Apps Script

hudcap opened this issue · 2 comments

Please forgive my ignorance -- I'm familiar with programming in general, but know very little about JS.

I'm trying to create a function in Google Sheets that will convert Hebrew and Gregorian dates using this library.
I imported the client side script into Google Apps Script and created a function, but quickly realized that scripts meant for a browser will not play well in GAS (e.g. window, setInterval, etc.), which runs the script on Google's servers (I think).

I get the feeling I'm going about this the wrong way - should I be using the Node version? I'm a little lost on how that works...

If anyone is able to help, I'd greatly appreciate it.
Thanks!

That's a good idea which i also thought of a couple days ago. :)

I haven't tried it or done too much research, but are you sure that it doesn't work in GAS? (Also, setInterval isn't specific to the browser.)

The first error I got is that window on line 902 (of hebcal.js from the client folder) is undefined. It seemed to me that this line makes Hebcal a global variable (you would know better :-)), so i got rid of the window. part, which should serve the same purpose.

The next error was from setInterval (line 2812), and when I found this, I gave up :)

I'm no programming expert. I enjoy getting code to work, so I program with one hand in the IDE and the other in Google, but I know once I'm out of my depth :)