Q:

MomentJS remove Time from Date Object (javascript)

I am using Moment.js to create a new date object and pushing to an array using the following code.
array.push(moment(object[column]).toDate());

The value of 'object[column]' is 2015-01-02 before creating the date object.
This array is used to generate a Google Chart using their API
The date becomes the following.
Fri Jan 02 2015 00:00:00 GMT-0500 (Eastern Standard Time)

I would like to parse it, to use it in the X Axis. I have tried the following but the console starts yelling.
array.push(moment(object[column]).toDate().format('MM/DD/YYYY'));
Uncaught TypeError: moment(...).toDate(...).format is not a function

I have tried this and the dates are off by months!
array.push(moment(object[column], 'MM/DD/YYYY').toDate());
Messed up data -"Wed Aug 15 1 00:00:00 GMT-0400 (Eastern Daylight Time),9,8,7,6,5,4,3,2,1

The outcome I am looking for is 1/1/15
 - Am I missing something? Thank you.

A:

Consider:
moment("2015-01-02").format("MM/DD/YYYY")  === "01/02/2015"

Putting it together with the other things you mentioned, you're probably looking for
array.push(moment(object[column]).format("MM/DD/YYYY"));

That pushes a formatted string into your array.  If instead you want a date object, then you would just push the date object:
array.push(moment(object[column]).toDate());

If it's just that it's not displaying in the chart the way you like, then use a DateFormat formatter, as described in the Google Charts documentation.

