Google App Script Calendar API - createAllDayEvent() method not working as expected - google-calendar-api

I've opened an issue about (what I assume) is a bug in Google App Scripts but it doesn't look like its being monitored so I wondering if anyone has a work around for my problem.
In summary I am running a script (via a google spreadsheet) which attempts to put an entry in a Google Calendar I created.
function testCalendarAllDayEvent(){
var calendar = CalendarApp.getCalendarById("od4434jhedv936p65gcbl3bjg#group.calendar.google.com");
var calTimezone = calendar.getTimeZone();
var scriptTimezone = Session.getTimeZone();
var calendarevent = calendar.createAllDayEvent("Test Event", new Date(2011,7,1));
var summary = calendarevent.getStartTime();
}
So the above code adds the "Test Event" on the 31st July 2011 instead of the 1st July. If I change it to
new Date (2011,7,2)it puts it in on the 1st August 2011. So it seems to be 30 days out.
The reason I look at the time zones it to ensure they are the same. When I look at the summary variable value it is Mon Aug 01 2011 01:00:00 GMT+0100 (IST)
I don't want to blindly add 30 days to all dates as it will just end in tears. Does anyone know if what I am doing is incorrect? I've used Google examples as templates.

The issue here is that the Date constructor takes a zero-based month index. So
new Date(2011,7,1) creates a Date of Aug 1 2011.
whereas
new Date(2011,6,1) creates a Date of July 1 2011.

Related

How to handle winter/summer time when formatting utc dates with Moment.js?

I have built a small calendar app. Events are stored in my database with Dates in UTC. My js code fetches these events and formats the UTC date to the local date of the user machine. Now I live in Sweden so if the UTC time is 10:00, the frontend should show 12:00. This works fine for me except when it comes to summer/winter time. In the frontend the user can set an event to repeat at specific dates. So for example I could set an event that starts at the 20 of every month to start at 12:00. However, lets say I add events from august to December. Events in August-October will show 12:00. Events from November to December will show 11:00. However, if I set a single event to start for example in December, it will show the correct date. What is the best way to deal with this?
This is how I format the utc date to my local date:
var d = moment.parseZone(startDate).local().format('L LT')

fullcalendar wrong timespamp for midnight

I am using fullcalendar.io and I realized that if I create a new event in the month view, dragging across one or more days, it returns a timestamp for the end date which is later rendered as 12 am of the day after while it should be logic that a function date("what-ever-format", timestamp) returns 12 pm of the current day, or, in any case, not the following day.
Any idea how to fix this???

Event Shift for one day for all-day event on fullcalendar

Having problem for "all-day" event that an event with start Nov 10 and end Nov 12 will span only 2 days on the calendar.
Looks like the documentation for the old version has the right one that I want it to work.
But with the new version, is there a way I can make it span for 3 days instead of 2 days without changing the end date?
The problem of changing the end date is that I allow user to store the end date. I don't think changing the end date from the user input is a good idea.
Any suggestion?
Yes, it looks like it is defined in that way in full calendar. For example if you drop some event on 3rd march for 1 day then
start : Mar 03 2020 00:00:00
end : Mar 04 2020 00:00:00
Hope it helps.

Implement a Custom Start date/End date Fullcalendar

We want to use Fullcalendar [monthly] view . we want to implement a calendar with
current month as October
which starts from 10 Oct 2013 to 20th Nov 2013 {42-DAY MONTH WINDOW}
I don't find any input parameters to be provided to calendar which takes Start date[20 Oct 2013] and end date[20 Nov 2013].
Please guide me out
I'm not sure I totally get what you are trying to achieve, but you could use the
Go To date function on document.ready to jump to October.
then only allow using the calendar next button once -
(hide the previous button on start, than after clicking the next button hide it and show the previous button and vice versa).

Display IST date and time for US Based server in Asp.net Calendar

I have an asp.net calendar that is used to display events taken from an access database. It works fine, but as the server is US based so according to Indian Standard Time(IST), it changes current day after 12:30 PM (11hrs, 30 min after actual IST time). This gets a little confusing for people using it.
I want a solution so that the calendar changes to today's date at correct time i.e. 12:00 AM IST. Or you may say that the time of the server should be added 11 hrs & 30 min so as to display date according to IST.
Solved!!!
Declared a DateTime variable and with DateTime.UtcNow, added 5 Hrs and 30 Min to the result.
Then this resultant DateTime is used as Today's Date.
DateTime todayDate = new DateTime();
todayDate = DateTime.UtcNow.AddHours(5).AddMinutes(30);
Calendar1.TodaysDate = todayDate;

Resources