code: function findOutNearestDate(x0, d0, d1){
              return (new Date(x0).getTime() - new Date(d0.date).getTime()) > (new Date(d1.date).getTime() - new Date(x0).getTime()) ? d0 : d1;
          }
docs: Finds out which datapoint is closer to the given x position
  @param  {Number} x0 Date value for data point
  @param  {Object} d0 Previous datapoint
  @param  {Object} d1 Next datapoint
  @return {Object}    d0 or d1, the datapoint with closest date to x0