0

How can I get something like this to work?

Example date format:

6/20/2016 10:30:00 AM

Example operation I want to perform:

parseDate(data["Checkin"]).getMonth() + 1

Current parseDate function:

var parseDate = d3.time.format("%m/%d/%Y %H:%M:%S %p").parse;

I am getting a data.slice is not a function TypeError when calling a d3 graphing function after the following:

var data = d3.csv("Sales Export Friendly 3-19-17.csv", function(data) {
    return {
        unit: data["Unit Booked"],
        date: parseDate(data["Booking Date"]).getMonth() + 1,
        checkin: parseDate(data["Checkin"]).getMonth() + 1,
        LOS: new Date(data["Checkout"]).valueOf() - new Date(data["Checkin"]).valueOf()/(24*60*60*1000),
        total: +data["Total Stay"],
        avgNight: (+data["Total Stay"]) / ((new Date(data["Checkout"]).valueOf() - new Date(data["Checkin"]).valueOf())/(24*60*60*1000)),
        }
Frederic Bastiat
  • 695
  • 4
  • 12
  • 31

0 Answers0