Forum Discussion

MichaelCurtis's avatar
MichaelCurtis
Qrew Cadet
8 years ago

trying to use the google calendar api to add events from quickbase

im trying to use the google calendar api to add events from quickbase it seems to take very specific dates and im thinking there might be a better way to do this. Here is my code.


(function(){
  var dbid = "application dbid";
  var dbidTable = "table dbid";
  var apptoken = "app token";
  $.ajaxSetup({data: {apptoken: apptoken}});
  $("a.QBU_Button").on("click", function(event) {
    console.log("onclick in module.js");
    var data = this.dataset.start;
    var title = this.dataset.title;
    var start = new Date(this.dataset.start).toISOString()
    var end = new Date(this.dataset.end).toISOString()

start = start.split("")
for(var i=0; i<start.length; i++){
start = start.replace("-","")
start = start.replace(":","")
start = start.replace(".","")
}
start = start.join("")

end = end.split("")
for(var i=0; i<end.length; i++){
end = end.replace("-","")
end = end.replace(":","")
end = end.replace(".","")
}
end = end.join("")

var day = start+"/"+end


  console.log(day);

   
  window.open('https://calendar.google.com/calendar/event?action=TEMPLATE&text=${title}&dates=${day}&lo...)
  });

})();
No RepliesBe the first to reply