Skip to content

Commit 9521956

Browse files
committed
Use tick format for tooltips as well
1 parent 10f89d9 commit 9521956

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

src/scales/scale.time.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -406,20 +406,6 @@ function ticksFromTimestamps(values, majorUnit) {
406406
return ticks;
407407
}
408408

409-
/**
410-
* Return the time format for the label with the most parts (milliseconds, second, etc.)
411-
*/
412-
function determineLabelFormat(timestamp) {
413-
var presets = adapter.presets();
414-
if (timestamp % INTERVALS.second.size !== 0) {
415-
return presets.full;
416-
}
417-
if (adapter.startOf(timestamp, 'day') !== timestamp) {
418-
return presets.time;
419-
}
420-
return presets.date;
421-
}
422-
423409
var defaultConfig = {
424410
position: 'bottom',
425411

@@ -643,7 +629,6 @@ module.exports = Scale.extend({
643629
var timeOpts = me.options.time;
644630
var label = data.labels && index < data.labels.length ? data.labels[index] : '';
645631
var value = data.datasets[datasetIndex].data[index];
646-
var ts;
647632

648633
if (helpers.isObject(value)) {
649634
label = me.getRightValue(value);
@@ -654,9 +639,7 @@ module.exports = Scale.extend({
654639
if (typeof label === 'string') {
655640
return label;
656641
}
657-
658-
ts = toTimestamp(label, timeOpts);
659-
return adapter.format(ts, determineLabelFormat(ts));
642+
return adapter.format(toTimestamp(label, timeOpts), timeOpts.displayFormats[me._unit]);
660643
},
661644

662645
/**

0 commit comments

Comments
 (0)