Addressing Date Validation Issues with Xano and Wized APIs
In this meeting, the State Changers discuss a data validation issue related to date formats. One participant, referred to as Banno, mentions that the date input field in their system does not accept non-American date formats. They have created a workaround by adding a text field and manipulating the date format using PHP.
The participants then discuss using regular expressions (regex) to validate the date format. However, it is noted that regex may not have full support and can be difficult for many people to handle. Instead, they propose creating a separate function for date validation.
They start by checking if the date string includes dashes or slashes to determine the separator used. They then split the date string into separate parts (day, month, and year). The idea is to validate each part (e.g., day should be between 1 and 31, month between 1 and 12) and return true or false accordingly. If the date is valid, they can proceed with converting it to a timestamp using a predefined format.
They discuss the benefits of using a more verbose approach to make the code easier to read and debug. They also mention the possibility of returning a validation message to the front end if the date is invalid.
Towards the end of the meeting, another participant named David joins the discussion with a new topic to discuss, but it is not elaborated further in the transcript.