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

Different Timezone calculations in ViewerComparator and LabelProvider #5

Open
etiennestuder opened this issue Sep 5, 2014 · 1 comment

Comments

@etiennestuder
Copy link

In TimeZoneLabelProvider#getStyledText, the offset calculation should be like this:
int offset = ((TimeZone) element).getOffset(System.currentTimeMillis());

rather than:
int offset = -((TimeZone) element).getOffset(0);

since this is also how the offset is calculated in TimeZoneViewerComparator.

Without this fix, the offsets displayed in the UI are not sorted and the minus/plus prefix is reverse.

Great book, btw! :-)

@tony--
Copy link

tony-- commented Jun 23, 2017

Thanks for the fix @etiennestuder - but it took me a couple minutes to work out WHY it fixes the issue.

The labels are not actually used for sorting - that's the point. Because they are not used for sorting the mismatched values makes the sorted zones appear to be unsorted.
Just to be clear, the zones are sorted correctly, but the offsets displayed in the labels do not match the ones used for sorting. The effect is that the zones appear to not be sorted.

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

No branches or pull requests

2 participants