0

Am trying to create an event in Facebook user and am using this code

var startDate = new Date(2013, 9, 5, 17, 0);
var endDate = new Date(2013, 9, 6, 17, 0);
var title = "Name";
var description = "My description.";
var data = {
    start_time : JSON.stringify(startDate),
    end_time : JSON.stringify(endDate),
    name : title,
    summary : description
};
//alert(data);
fb.requestWithGraphPath("me/events", data, "POST", function(e){
    if(e.success){
        alert(e.success);
    }else if(e.error){
        alert(e.error);
    }else{
        alert("Unknown Response");
    }
});

And getting a response like this. Is facebook changed any parameter intake or any error in my code?

ksugiarto
  • 940
  • 1
  • 17
  • 40
Guts
  • 81
  • 4
  • 20
  • 1
    Yeah.. As per facebook changed its input parameter value by accessing ISO 8601 date string, we have to change the date to ISO format using ".toISOString()" function and remove stringify() in json formation and it works. But ".toISOString()" is not compatible with IE8 and konq4.9 browser. As we goes with mobile development, it will surely run if not refer [this](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FDate%2FtoISOString). Thank you guys. – Guts Sep 02 '13 at 08:53
  • Can you print `start_time` `end_time` – Sahil Mittal Sep 02 '13 at 09:07
  • For start_time = 2013-10-05T11:30:00.000Z and end_time = 2013-10-06T11:30:00.000Z – Guts Sep 02 '13 at 10:30
  • The right way to implement is to use momentjs by require('alloy/moment') and utilize [its](http://momentjs.com/) date functionalities and format() to convert it to ISO format. I used the below code, – Guts Sep 02 '13 at 13:58

0 Answers0