Home › Forums › Report Bugs › Date displaying 1 month › Reply To: Date displaying 1 month
@faulduff,
In JavaScript, date object can be created in 4 ways. new Date(), new Date(year, month, day, hours, minutes, seconds, milliseconds), new Date(milliseconds), new Date(date string).
new Date()
new Date(year, month, day, hours, minutes, seconds, milliseconds)
new Date(milliseconds)
new Date(date string)
In your case i.e new Date(year, month, day), month counts from 0 to 11 i.e. 0 corresponds to January and 11 corresponds to December. Changing the month according to JavaScript date-object should work fine in your case.
new Date(year, month, day)
For different JavaScript date formats please refer this article.
Please take a look at this JSFiddle for a working example with sample code.
— Vishwas R Team CanvasJS