Closed StephenCoady closed 9 months ago
hi @StephenCoady thanks for using and help me to improve this little tool (I just made a huge refactoring to make it more maintainable, so little bugs are expected).
please, as I don't live in a timezone which has daylight saving I don't think I understood your point.
currently I see two options:
A) fetch the "corrected" timezone one time per day from a place/api which has the correct values (I need to check if there is such api) B) create another GAS_appsscript.json option in order to set the current timezone based on which month of the year or something like that
what do you think it would be the best? if you have another options or details I'd appreciate.
Hi, @lucasvtiradentes.
So maybe I can explain a little better.
Every 6 months or so my timezone changes by 1 hour either forward or backwards. That means the setting timeZoneCorrection
is now incorrect for me, and I need to change the script. I took a look at the ics data and it looks like timezone is included as part of each event data. It also looks like timezone data might be available as part of the Google Scripts environment.
So, I'm wondering if it would be possible to either:
timeZoneCorrection
variable and instead just use the ticktick timezone information.
or timeZone
from Google scripts.The advantage to both of these situations is the user gets to set their timezone either in ticktick or in the script but I guess this depends on how you use that variable in the script. My assumption is that you only use it for tasks and setting the time they should be displayed in the calendar.
Hi, understood! thanks for clarifying!
I have tried to solve this after work but I could not, my progress was:
get the timezone from user's primary google calendar (CalendarApp.getDefaultCalendar().getTimeZone())
I also added some javascript date utils functions.
on the weekend i'll release a new version but i believe the final test will be when you timezone changes due to the daylight saving.
Hi @StephenCoady , I just release a new version.
In one way I'm happy because I ditched the need of specifying the timezone correction, props to your for giving me the reason to search about it.
On the other hand, I found no final solution for "detect" if the user is on daylight saving period. so my solution was to add a new key to the user specify to gcal-sync that it should add or remove x hour from the current timezone offset.
if you still want a "automatically" way to do it, you're more than welcome to contribute to this project, I will leave bellow some article on which some people are discussing about it (detect daylight saving in javascript):
from what I've read it did not seemed like a "exact truth", it depends. if you'll try remember that in the and what we need is a numerical value, so lets say you default timezone offset number from utc is +5, and in the daylight saving period there's a 1 hour gap, what I need is +4 or +6. also keep in mind that we can not use external packages like momentum, it needs to be pure js.
Regards!
No problem, it probably comes down to my misunderstanding of how the times are assigned. I thought we could use the google app script timezone or the timezone of each item coming from the ics.
If I get some time I'll take a look myself and see if any ideas come to me.
Thanks anyway!
dist/setup/GAS_appsscript.json has timeZone available, which is the user's preference. Currently, if you live in a timezone which has daylight savings, then you need to change timeZoneCorrection every ~6 months.
Calculating this value from timeZone instead would mean the user could set and forget this value and it would be kept up to date automatically.