Not working calendar event properly

if I using this code, not working properly because in this code we use date July, but on the calendar show in August month …

$scope.events = [
{ id:1, text:“Task A-12458”,
start_date: new Date(2018, 07, 30, 9, 0),
end_date: new Date(2018, 07, 30, 16, 0) },
{ id:2, text:“Task A-83473”,
start_date: new Date(2018, 10, 28, 9, 0),
end_date: new Date(2018, 10, 30, 16, 0) }
];

one more thing …
Can I use
$scope.events = [
{ id:1, text:“Task A-12458”,
start_date: new Date(2018, 07, 30),
end_date: new Date(2018, 07, 30) },
{ id:2, text:“Task A-83473”,
start_date: new Date(2018, 10, 28),
end_date: new Date(2018, 10, 30) }
];

This code only ? In this code I have not used ,9,0 in the last, so Is it required to use full value start_date: new Date(2018, 07, 30, 9, 0),

Can you please help me …


Hi,

new Date(2018, 07, 30) -> it is 30th of August.
JavaScript counts months from 0 to 11. January is 0. December is 11.
I think this article can be useful for you w3schools.com/js/js_dates.asp

The last two values in date format are “hours:minutes”. It is not required to specify time for events if you don’t need. Time will be set as 00:00 by default.

The initial date of the scheduler is specified in init() method and Scheduler will be render on that date after the first loading.
docs.dhtmlx.com/scheduler/api__ … _init.html

Hi Polina,

Thank you so much for reply.
Can you help me , I am a new in angular and JS.

I am selecting all dates from database and store in one variable like below

Data.get(‘eventScheduler’).then(function (results) {
if (results) {

    $scope.events = results;
    console.log($scope.events);   

     } else {
      $location.path("/calendar");
    }
});

my database value is
{id: “4”, text: “Only For Testing”, start_date: “2018-07-22 18:30:00”, end_date: “2018-07-24 18:30:00”}

and in Java script value is
{id: “4”, text: “Only For Testing”, start_date: Tue Feb 07 2090 18:30:00 GMT+0530 (India Standard Time), end_date: Thu Feb 07 2092 18:30:00 GMT+0530 (India Standard Time), _timed: false}
How can display proper got data from database .
in this article I have store all data in events, so how I can define the indexing got data .
Thanks again.

Hi,

Please read in the article how to load data from the server in the implementation of Scheduler with Angular:
dhtmlx.com/blog/angular-dhtmlxs … -tutorial/