We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cafcaf3 commit 11d8ee0Copy full SHA for 11d8ee0
src/Histogram.js
@@ -19,9 +19,10 @@ class Histogram extends Component{
19
formatHistogram(histogram) {
20
return Object.keys(histogram).sort().map(x => {
21
return {
22
- // Adjust the 24 hour 'name' for local timezone
23
- 'name': ((parseInt(x) - new Date().getTimezoneOffset() / 60 + 24) % 24).toString().padStart(2,"0"),
24
- 'count': histogram[x]
+ // Display the histogram starting at midnight --local-- time.
+ // To do this, access the histogram bins with the index adjusted by the timezone offset in hours.
+ 'name': x,
25
+ 'count': histogram[((parseInt(x) + new Date().getTimezoneOffset() / 60 + 24) % 24).toString().padStart(2,"0")]
26
}
27
})
28
0 commit comments