function formatShowtimes(showtimes) {
  var today = new Date();
  var d = today; // TODO Consider today, tomorrow, etc.

  var middle = -1;
  for (var i = 0; i < showtimes.length; i++) {
    if (showtimes[i + 1]) {
      var curr = parseInt(showtimes[i].split(':')[0]);
      var next = parseInt(showtimes[i + 1].split(':')[0]);
      if (curr > next) {
        middle = i;
        //console.log(showtimes[i] + ' ' + showtimes[i + 1] + ' ' + middle);
        break;
      }
    }
  }

  return showtimes.map(function(s, i) {
    var hm = s.split(':');
    var date = new Date(d.getTime());

    var pm = true;
    if (i <= middle)
      pm = false;

    if (pm)
      date.setHours(parseInt(hm[0]) + 12);
    else
      date.setHours(hm[0]);

    date.setMinutes(hm[1]);
    date.setSeconds(0);

    return date;
  });
}
function formatShowtimes(showtimes) {
  var today = new Date();
  var d = today; 

  var middle = -1;
  for (var i = 0; i < showtimes.length; i++) {
    if (showtimes[i + 1]) {
      var curr = parseInt(showtimes[i].split(':')[0]);
      var next = parseInt(showtimes[i + 1].split(':')[0]);
      if (curr > next) {
        middle = i;
        
        break;
      }
    }
  }

  return showtimes.map(function(s, i) {
    var hm = s.split(':');
    var date = new Date(d.getTime());

    var pm = true;
    if (i <= middle)
      pm = false;

    if (pm)
      date.setHours(parseInt(hm[0]) + 12);
    else
      date.setHours(hm[0]);

    date.setMinutes(hm[1]);
    date.setSeconds(0);

    return date;
  });
}
function formatShowtimes ( showtimes ) { var today = new Date ( ) ; var d = today ; // TODO Consider today, tomorrow, etc. var middle = - 1 ; for ( var i = 0 ; i < showtimes . length ; i ++ ) { if ( showtimes [ i + 1 ] ) { var curr = parseInt ( showtimes [ i ] . split ( ':' ) [ 0 ] ) ; var next = parseInt ( showtimes [ i + 1 ] . split ( ':' ) [ 0 ] ) ; if ( curr > next ) { middle = i ; //console.log(showtimes[i] + ' ' + showtimes[i + 1] + ' ' + middle); break ; } } } return showtimes . map ( function ( s , i ) { var hm = s . split ( ':' ) ; var date = new Date ( d . getTime ( ) ) ; var pm = true ; if ( i <= middle ) pm = false ; if ( pm ) date . setHours ( parseInt ( hm [ 0 ] ) + 12 ) ; else date . setHours ( hm [ 0 ] ) ; date . setMinutes ( hm [ 1 ] ) ; date . setSeconds ( 0 ) ; return date ; } ) ; }
Private
Private