Hi Stephen,
It looks like the Date constructor isn't parsing your dates properly.
Experimenting with it in the console, I found that:
new Date(2016, 5, 2) results in the date "Thu Jun 02 2016 00:00:00 GMT-0400
(EDT)"
new Date('2016-06-02') results in the date "Wed Jun 01 2016 20:00:00
GMT-0400 (EDT)"
Note that this is a very different date than what we expected.
Experimenting with it a bit more, it appears that the following works
properly:
new Date('06-02-2016') results in the date "Thu Jun 02 2016 00:00:00
GMT-0400 (EDT)"
So it appears that the date constructor doesn't understand strings in the
form "yyyy-mm-dd", but in "mm-dd-yyyy". This probably differs based on
locale as well. If I were you, I would not use such an error-prone method
to construct my dates. If your dates come in that form, it would be best
for you to parse them yourself (or use another library like date.js
<http://www.datejs.com/>) and hand the components to the Date constructor
so that there is no room for confusion.
On Thu, Mar 24, 2016 at 5:53 AM <[email protected]> wrote:
> I am trying to create a timeline chart in which multiple blocks are on the
> same line, butted against each.
>
> However it is splitting them apart although it is keeping them in the same
> grouping row. The strange thing is when I change the date format it results
> in them lining up as I want them to.
>
> I've a fiddle here in which you can see both cases
> https://jsfiddle.net/bj46bxL9/
>
> The problem is the date format that works is 'new Date(yyyy, mm, dd) '
> which uses zero based months and my data isn't zero based so the date
> format I'm using new Date('yyyy-mm-dd') displays the correct date but seems
> to cause the blocks to not line up.
>
> Does anyone know why they are splitting and how can I stop it from
> happening.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to
> [email protected].
> Visit this group at
> https://groups.google.com/group/google-visualization-api.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-visualization-api/e4b35b6d-c394-49eb-ab38-9c861b495245%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/e4b35b6d-c394-49eb-ab38-9c861b495245%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
*[image: unnamed.gif]• Sergey Grabkovsky• Software Engineer• Google, Inc•
[email protected] <[email protected]>*
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/CAEwwup59v4SYM%2BPqo1vHbvEbRJsrmkZa2GsrgQOgtW2WwbBRag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.