jiahuang / d3-timeline

Simple JS timeline plugin for d3
1.03k stars 282 forks source link

Timezone support? #43

Closed BreadMaker closed 8 years ago

BreadMaker commented 9 years ago

I'm struggling trying to add timezone support for my little project, but I can't yet figure out how to show the data (which is in UTC) to UTC. Instead of that, I get the translated time (UTC-3) in my case. I'm missing something?

aplayspace commented 9 years ago

I have a similar timezone question. My data is in unix timestamp format. I need to visualize the data for EST (New York) and account for Daylight Savings Time. Does anyone have any pointers on how to go about this? Thank you!

On 12 March 2015 at 22:10, Felipe Peñailillo notifications@github.com wrote:

I'm struggling trying to add timezone support for my little project, but I can't yet figure out how to show the data (which is in UTC) to UTC. Instead of that, I get the translated time (UTC-3) in my case. I'm missing something?

Reply to this email directly or view it on GitHub https://github.com/jiahuang/d3-timeline/issues/43.

ryanfox commented 8 years ago

@BreadMaker I was having the same issue. Turns out this is a d3 issue, not specific to timeline. I had used this from one of the examples:

.tickFormat( //
        {format: d3.time.format("%I %p"),
        tickTime: d3.time.hours,
        tickInterval: 1,
        tickSize: 30})

d3.time.format returns localized times. You want d3.time.format.utc(...) That got me UTC labels for my tick marks instead of local time.

BreadMaker commented 8 years ago

Wow, that points at the right direction. Thanks @ryanfox !