Romeo Casimina 3 Posted February 14, 2019 Share Posted February 14, 2019 Hi, I am trying to validate a date field in my forms that it should follow certain format (yyyy-MM-dd). I was able to display it in the correct format by using the property resource setting. However, one thing that I am curious about is that if I enter 2019-02-31, it will be automatically be converted to 2019-03-03 and will not fail validation. Is this the default behavior, or can this behavior be changed Link to comment Share on other sites More sharing options...
Adrian Price Posted February 18, 2019 Share Posted February 18, 2019 Looks like the date control is automatically normalising the date value if any field overflows (you might also find that entering 2019-13-31 would end up as 2020-01-31). This is the default behaviour and there is no way to change it other than by writing your own custom validation for that particular standard control instance or to implement your own custom control for capturing dates. Since you would presumably wish a custom validation to apply to all date control instances in all forms, you could write the validation logic in an external JavaScript resource and invoke it from a custom validation for each date control instance. Link to comment Share on other sites More sharing options...
Romeo Casimina 3 Posted February 22, 2019 Author Share Posted February 22, 2019 Thanks, aprice. This might be related to how Java/Javascript treats date objects that is it just add milliseconds to Jan 1, 1970 and reformat it from there. Thus it will consider adding 13 months. :) Anyway, would you be able to provide sample of using external Javascript validation getting the value as entered by the user My intent is how I can pass the value entered by the user and not the normalized date value e.g. 2019-13-31 and not "Fri Jan 31 00:00:00 PST 2020". Otherwise, the only way is custom control which might be tedious as we need to replicate all functionalities of the date time control (and I assume, TIBCO will not provide the source code for the date time control so we can customize it). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now