Trouble with Tooltips D3 Bar Chart

So I think I have the project finished but the 2nd tooltip test is failing whenever its picking a date that’s earlier than October. For every bar with the month of October I pass all the tests.
This is the error I get:
Tooltip's "data-date" property should be equal to the active area's "data-date" property: expected '1999-7-01' to equal '1999-07-01'
But that error doesn’t make sense to me because im actually copying the value from the bars data-date property and passing it to the tool tip. I also console.log() every value from the tool-tip and they seem to be all right. I noticed the test somehow deletes a zero form the month but I don’t know why.

Heres the link to my pen :

Look at the error; the month has the wrong format. It expects 07 and your code provided 7. Looks like you would need to modify how you set the data-date attribute.

Anytime something works for 10 and up and fails for smaller values, suspect a formatting issue where a two digit format is expected, but one is provided.

I know. But if you check the values with dev tools they are exactly the same. Somehow the test gets rid of one zero. I console log both values and they are the same. If I do it the same way like in the provided solution page. It gets stuck at the first value from the JSON.

Okay this is some very strange behavior I simply put the .attr(data-data, time) line above the .text() method. And now somehow it passes every time all tests.