diff --git a/src/scales/scale.time.js b/src/scales/scale.time.js index 9db772cb520..a01ccf9b890 100644 --- a/src/scales/scale.time.js +++ b/src/scales/scale.time.js @@ -406,20 +406,6 @@ function ticksFromTimestamps(values, majorUnit) { return ticks; } -/** - * Return the time format for the label with the most parts (milliseconds, second, etc.) - */ -function determineLabelFormat(timestamp) { - var presets = adapter.presets(); - if (timestamp % INTERVALS.second.size !== 0) { - return presets.full; - } - if (adapter.startOf(timestamp, 'day') !== timestamp) { - return presets.time; - } - return presets.date; -} - var defaultConfig = { position: 'bottom', @@ -643,7 +629,6 @@ module.exports = Scale.extend({ var timeOpts = me.options.time; var label = data.labels && index < data.labels.length ? data.labels[index] : ''; var value = data.datasets[datasetIndex].data[index]; - var ts; if (helpers.isObject(value)) { label = me.getRightValue(value); @@ -654,9 +639,7 @@ module.exports = Scale.extend({ if (typeof label === 'string') { return label; } - - ts = toTimestamp(label, timeOpts); - return adapter.format(ts, determineLabelFormat(ts)); + return adapter.format(toTimestamp(label, timeOpts), timeOpts.displayFormats[me._unit]); }, /**