When using a time column with finalizeCellEdit in Grid 6.2.0, the error state incorrectly persists even after entering a valid time value. This issue specifically occurs in the following scenario:
User attempts to set a time in the past, triggering validation error
User then tries to set a valid future time
The error state remains active despite the valid input
This behavior is not present in Grid 6.0.3
Steps to reproduce:
Open the grid example
Copy paste attached code
import { Grid, Toast, DataGenerator } from '../../build/grid.module.js?484519';
const grid = new Grid({
appendTo : 'container',
data: [
{ id: 1, name: 'Task 1', description: 'First task', alertTime: new Date(), status: 'Active' },
{ id: 2, name: 'Task 2', description: 'Second task', alertTime: new Date(), status: 'Pending' }
],
columns: [
{
field: 'name',
text: 'Name',
width: 150
},
{
field: 'description',
text: 'Description',
flex: 1
},
{
type: 'time',
field: 'alertTime',
text: 'Alert Time',
width: 120,
editor: {
type: 'time',
keepDate: true
},
finalizeCellEdit: ({ value }) => {
const currentTime = new Date();
const selectedTime = new Date(value);
// Set seconds and milliseconds to 0 for accurate comparison
currentTime.setSeconds(0, 0);
selectedTime.setSeconds(0, 0);
if (selectedTime < currentTime) {
return 'Cannot set time in the past';
}
return true;
}
},
{
field: 'status',
text: 'Status',
width: 100
}
],
});
Set time to a past value (validation error appears)
Attempt to set time to a future value
Observe that error state remains despite valid input
Expected behavior: Error state should clear when a valid time value is entered.
Actual behavior: Error state persists even after entering valid time value.
Attached is video for reference.