| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 
 |     var dataset = [
        {
            "id":1557,
            "counts":null,
            "title":"admin",
            "description":"",
            "start":"2014-05-27T14:00:00+02:00",
            "backgroundColor":"#587ca3",
            "borderColor":"#587ca3",
            "end":"2014-05-27T17:00:00+02:00",
            "allDay":false
       },
       {
           "id":1558,"counts":null,"title":"admin","description":"","start":"2014-05-31T14:00:00+02:00",
           "backgroundColor":"#587ca3","borderColor":"#587ca3","end":"2014-05-31T15:00:00+02:00","allDay":false
       },
       {
           "id":1559,"counts":null,"title":"admin","description":"","start":"2014-05-29T14:00:00+02:00",
           "backgroundColor":"#587ca3","borderColor":"#587ca3","end":"2014-05-29T15:00:00+02:00","allDay":false
       },
       {
           "id":1560,"counts":null,"title":"admin","description":"","start":"2014-05-30T14:00:00+02:00",
           "backgroundColor":"#587ca3","borderColor":"#587ca3","end":"2014-05-30T15:00:00+02:00","allDay":false
       },
       {
           "id":1561,"counts":null,"title":"admin","description":"","start":"2014-06-01T14:00:00+02:00",
           "backgroundColor":"#587ca3","borderColor":"#587ca3","end":"2014-06-01T15:00:00+02:00","allDay":false
       },
       {
           "id":1562,"counts":null,"title":"admin","description":"","start":"2014-05-28T14:00:00+02:00",
           "backgroundColor":"#587ca3","borderColor":"#587ca3","end":"2014-05-28T15:00:00+02:00","allDay":false
       },
       {
           "id":1564,"counts":null,"title":"admin","description":"","start":"2014-06-11T21:45:00+02:00",
           "backgroundColor":"#587ca3","borderColor":"#587ca3","end":"2014-06-11T21:45:00+02:00","allDay":false
       }
    ];
 
    var tab = [];
 
    /*
     * dateEnd - dateStart = millisecondes
     * heures = millisecondes / ( 1000 * 60 *60 )
     */
 
    $.each( dataset, function( i, item ){
        tab.push( [ item.id, ( new Date( item.end ) - new Date( item.start ) ) / ( 1000 * 60 * 60 ), ( item.allDay ) ? ( 7 ) : ( 5 ) ] );
    });
 
    console.log( tab ); | 
Partager