Fix Chrome/Edge compatibility

Chrome does not support valueAsDate on datetime-local inputs
This commit is contained in:
RunasSudo 2024-08-28 08:58:41 +10:00
parent 4e4248a9ae
commit e016afbf45
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -133,11 +133,11 @@ function updateBilirubin() {
let bilirubin = document.getElementById('bilirubin').valueAsNumber;
let gestation = document.getElementById('gestation').valueAsNumber;
if (document.getElementById('time_birth').valueAsDate === null) {
if (document.getElementById('time_birth').value === '') {
resultDiv.className = 'hidden';
return;
}
if (document.getElementById('time_measurement').valueAsDate === null) {
if (document.getElementById('time_measurement').value === '') {
resultDiv.className = 'hidden';
return;
}
@ -150,7 +150,7 @@ function updateBilirubin() {
return;
}
let [d, result_text, text_colour, background_colour, accent_colour] = describeBilirubin(gestation, document.getElementById('time_birth').valueAsDate, document.getElementById('time_measurement').valueAsDate, bilirubin);
let [d, result_text, text_colour, background_colour, accent_colour] = describeBilirubin(gestation, new Date(document.getElementById('time_birth').value), new Date(document.getElementById('time_measurement').value), bilirubin);
chart.data.datasets[2].data = [{x: d, y: bilirubin}];
chart.update();