Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/scales/scale.time.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function sorter(a, b) {
*/
function parse(scale, input) {
if (isNullOrUndef(input)) {
return null;
return NaN;
}

const adapter = scale._adapter;
Expand All @@ -67,7 +67,7 @@ function parse(scale, input) {
}

if (value === null) {
return value;
return NaN;
}

if (round) {
Expand Down
50 changes: 50 additions & 0 deletions test/fixtures/scale.time/invalid-data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
module.exports = {
description: 'Invalid data, https://github.com/chartjs/Chart.js/issues/5563',
config: {
type: 'line',
data: {
datasets: [{
data: [{
x: '14:45:00',
y: 20,
}, {
x: '20:30:00',
y: 10,
}, {
x: '25:15:00',
y: 15,
}, {
x: null,
y: 15,
}, {
x: undefined,
y: 15,
}, {
x: NaN,
y: 15,
}, {
x: 'monday',
y: 15,
}],
}]
},
options: {
scales: {
x: {
type: 'time',
time: {
parser: 'HH:mm:ss',
unit: 'hour'
},
},
},
layout: {
padding: 16
}
}
},
options: {
spriteText: true,
canvas: {width: 1000, height: 200}
}
};
Binary file added test/fixtures/scale.time/invalid-data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.