Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.8 $.plot.formatDate() regression #1021

Closed
frediana opened this issue Apr 19, 2013 · 2 comments
Closed

0.8 $.plot.formatDate() regression #1021

frediana opened this issue Apr 19, 2013 · 2 comments
Labels

Comments

@frediana
Copy link

Hi,

I just trying to upgrade flot version from 0.7 to 0.8. I'm facing something that look like a regression on the $.plot.formatDate function.

I have a graph, that is displaying time values, and tooltip on hover series.

In 0.7 I used to display the date on this tooltip like this:

$.plot.formatDate(new Date(timestamp), '%m/%d/%y - %h:%M:%S')

Here I got 2 regressions:
1/ Easy one, is that '%h' is not supported anymore in the string format. Not big deal I jusr replaced with '%H'. I'm just saying, I don't know if you're planning to fix this.

2/ more problematic to me, it seems now there's somehow a utc or timezone offset problem, for example:

in 0.7 something displayed: '04/19/13 14:56:20'
in 0.8 will be displayed: '04/19/13 16:56:20'

with a 2 hours offset.

@dnschnur
Copy link
Member

The switch from %h to %H was intentional; %H is the standard strftime hour formatter, and Flot's use of %h was essentially a bug. At the same time, since we don't use %h for anything else, I think there's no reason why we shouldn't provide a little bit of backwards-compatibility. So I've added back %h, but documented it as deprecated, to be removed in version 1.0.

As for the other problem, can you provide an example of the data and options that you used?

@keithdmoore
Copy link

In my case, the timestamp was already in UTC. Even though I did NOT set the timezone option on the xaxis, the axis label was correct. However, when I used the formatDate function in order to show a tooltip, I had to do this to get the time to display correctly:

var timestamp = item.datapoint[0];
var flotFormattedDate = $.plot.formatDate($.plot.dateGenerator(timestamp, { timezone: "utc"}), "%m/%d/%Y %H:%M:%S");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants