Open neoneddie opened 10 years ago
Well, you just need to convert your MySQL date in a correct way to a JavaScript date. There are plenty of ways do do that. Lets say we want to convert April 15th, 2014 into a JavaScript date:
new Date(2014, 4 - 1, 15)
.new Date('04/15/2014')
. In modern browsers you can construct a date from ISO date string like new Date('2014-04-15')
.new Date(1400104800000)
. (You can output these timestamps from MySQL).moment('2014-04-15').toDate()
.So depending on what date fromat you get from your MySQL data, you have to run a for loop over the data to convert the start
and end
properties in valid JavaScript dates, and then feed that to the Timeline.
Date is off by one month
I know this has been covered and that JS is zero based (or something like this). But I am still confused by the date that I want to be displayed is not displayed.
IE: 'start': new Date(2014,4,2), ...does not show a milestone on 4/2/2014
My timeline deals with business days of the week. I am pulling the dates from a MySQL database that I want to be displayed on the timeline. So if the MySQL date is Wednesday 4-2-2014, and I want a point to display as 4-2-2014 on the timeline, wouldn't I have to subtract a month from that date to display it correctly on the timeline? Once I do that, the days of the week will always be messed up.
Bottom line is:
I already know how to calculate the business days and format them into the Y,m,d format. But what I can't do is enter this number into the timeline script because the date is a month off.
I hope I am clear.