So this is the first time I've ever encountered this error:
The system that received this error is a database/calendar-access UI I built. The system required extensive testing and I have never seen this error message before. Moreover, the system has been working perfectly for the past few months and my boss just sent me an email with a screenshot of the error.
It seemed at first that the issue was that the spreadsheets and scripts involved were not in the same time zone (times for events in the database were different from those on the calendar, so I figured it was time zones). I put everything in the same time zone and it seemed to work fine.
But then I tried it again, same error. I've done some investigating, and the following is coming up in my logs:
Event info: project_trainingDate1 --> Fri Mar 28 2014 00:00:00 GMT-0400 (EDT)
Event info: project_trainingDate2 --> Wed Mar 26 2014 19:00:00 GMT-0400 (EDT)
When clearly the UI has the following values:
Note: Dates that exist in the database set the UI DateBox
to that date. That means that in the above example, trainingDate1
was in the database, so the DateBox.setDate()
function is working as usual. However, dates such as trainingDate2
are those that I just created in the UI, meaning the DateBox
widget had no previous value set. I imagine this is where the differences in time are coming from.
The second Date object is effectively newDate(UI value - 5 hours)
, which definitely poses a problem because the real date ends up a day behind when the time is set later.
I have not encountered this problem before, nor has my boss. This leads me to believe that there is a time zone issue somewhere, and that it has developed recently due to some change... however, I have double and triple-checked time zone settings on:
- All spreadsheets that have data being accessed in them by the script
- All script projects involved in this system
- All calendars on the account that use the system
All time zone settings are GMT -0500, as they have been for several months. It honestly makes no sense - I thought that the time zone was the issue, however it seems to be occurring with random values... see the following in the log of the UI-retreived values:
Event info: project_editingDate1 --> Sat Mar 29 2014 00:00:00 GMT-0400 (EDT)
Event info: project_editingDate2 --> Sat Mar 29 2014 19:00:00 GMT-0400 (EDT)
Event info: project_editingDate3 --> Sun Mar 30 2014 18:00:00 GMT-0400 (EDT)
Where the UI values were the following:
editingDate1
was a DateBox
value that had its value set by the entry in the database. However, and even more bizarrely, editingDate2
and editingDate3
are an hour apart (as well as having both of their times wrong).
So the question: What type of time-zone or other issue related to DateBox
is throwing off the values by 5 or 6 hours?
Keep in mind that no time zone settings have changed in this project, and the same calendar and code have been used without change for the past 3 months; now this bizarre behavior is occurring and I can't figure out why. Any thoughts?
P.S. - I know that script time zones differing from spreadsheet time zones can often be the source of errors, but I never encountered this 'DateBox
returning expected hours -5' problem in my two weeks of extensive testing I did before I published the project, and every time zone setting is exactly the same as it was before.
P.P.S. - I am accessing the system from France, but I am logged into our work's admin account which hosts the system. My personal time zone difference shouldn't override the system time zone settings... but the difference in hours almost makes me believe that I'm just missing something really obvious.