Skip to content

Commit

Permalink
Fix detection of tooltip fallback format
Browse files Browse the repository at this point in the history
Use `adapter.startOf(ts, 'day') !== ts` instead of introducing a new adapter API to detect when the timestamp is midnight in the current timezone.
  • Loading branch information
simonbrunel committed Jan 9, 2019
1 parent 46b951e commit d352066
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/scales/scale.time.js
Expand Up @@ -417,7 +417,7 @@ function determineLabelFormat(timestamps) {
if (ts % INTERVALS.second.size !== 0) {
return presets.full;
}
if (ts % INTERVALS.day.size !== 0) {
if (!hasTime && adapter.startOf(ts, 'day') !== ts) {
hasTime = true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/specs/scale.time.tests.js
Expand Up @@ -662,8 +662,8 @@ describe('Time scale tests', function() {
datasets: [{
xAxisID: 'xScale0',
data: [
{t: +new Date('2018-01-08 00:00:00Z'), y: 10},
{t: +new Date('2018-01-09 00:00:00Z'), y: 3}
{t: +new Date('2018-01-08 00:00:00'), y: 10},
{t: +new Date('2018-01-09 00:00:00'), y: 3}
]
}],
},
Expand Down

0 comments on commit d352066

Please sign in to comment.