Skip to content

Commit d352066

Browse files
committed
Fix detection of tooltip fallback format
Use `adapter.startOf(ts, 'day') !== ts` instead of introducing a new adapter API to detect when the timestamp is midnight in the current timezone.
1 parent 46b951e commit d352066

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/scales/scale.time.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ function determineLabelFormat(timestamps) {
417417
if (ts % INTERVALS.second.size !== 0) {
418418
return presets.full;
419419
}
420-
if (ts % INTERVALS.day.size !== 0) {
420+
if (!hasTime && adapter.startOf(ts, 'day') !== ts) {
421421
hasTime = true;
422422
}
423423
}

test/specs/scale.time.tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,8 @@ describe('Time scale tests', function() {
662662
datasets: [{
663663
xAxisID: 'xScale0',
664664
data: [
665-
{t: +new Date('2018-01-08 00:00:00Z'), y: 10},
666-
{t: +new Date('2018-01-09 00:00:00Z'), y: 3}
665+
{t: +new Date('2018-01-08 00:00:00'), y: 10},
666+
{t: +new Date('2018-01-09 00:00:00'), y: 3}
667667
]
668668
}],
669669
},

0 commit comments

Comments
 (0)