Discussions

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

  • 1.  trying to use the google calendar api to add events from quickbase

    Posted 12-20-2017 23:31
    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[i] = start[i].replace("-","")
    start[i] = start[i].replace(":","")
    start[i] = start[i].replace(".","")
    }
    start = start.join("")

    end = end.split("")
    for(var i=0; i<end.length; i++){
    end[i] = end[i].replace("-","")
    end[i] = end[i].replace(":","")
    end[i] = end[i].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...)
      });

    })();