Issue with Date Picker Validation in ServiceNow UI Builder

Serhii Riznyk
Tera Contributor

I encountered a problem with the date picker validation in ServiceNow UI Builder. I implemented logic to check if the selected date is in the past, and if so, the validation should fail, making the field invalid (turning red). The issue occurs after I select the same past date twice.

Here's the scenario:

  1. When I first select a past date, the validation works as expected: the field turns red, and the validation error is logged.
  2. However, when I select the same past date again, the field no longer turns red, despite the logs showing that the validation has still failed. It seems that the validation logic is firing, but the field's state is not updated visually.

What I've implemented:

  • I store the selected date and whether validation is required in the state.
  • Upon any state change, I trigger the validation check.
  • Despite this, when selecting the same date twice, the UI doesn't update as expected, even though the state is changing, and the validation logic runs correctly in the background.

What I've tried so far:

  • I confirmed that the correct data is being passed after the second date selection.
  • I attempted to manually force the component to re-render or update, but the issue persists.

SerhiiRiznyk_0-1729765902110.png

SerhiiRiznyk_1-1729765958960.png

 

 

0 REPLIES 0