hebcal / hebcal-js

⛔️ DEPRECATED - a perpetual Jewish Calendar (JavaScript)
GNU General Public License v3.0
124 stars 40 forks source link

Google Apps Script #43

Open hudcap opened 7 years ago

hudcap commented 7 years ago

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!

Scimonster commented 7 years ago

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.)

hudcap commented 7 years ago

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 :)