Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

DateTime field accepts zeroes for year without throwing error

SA-11127

Summary



When dates do not conform to standard calendar format {(m)m/(d)d/yyyy} a client-side error is thrown because this validation is built into the Date control. This validation is triggered  when day values are outside of standard expected values, as in the 5/40/2015 example.
 However for  5/4/0000 , which is in a valid date format, the date control does not validate at client side for year value "0000" , but an error is posted from the process engine. There is no consistency in validating dateTime values. 



Error Messages



** The first date 5/11/0000 could not be parsed

Steps to Reproduce



1. Create a section with dateTime field.
2. Enter a value with "0000" for year. e.g. 05/11/0000 and click Submit.



Root Cause



Pega provides an available rule - HTML fragment - CustomValidators to extend the validation functionality provided by the product. User can customize the functions to meet their requirements.

Resolution



This issue is resolved through the following local-change:

1. Save CustomValidators HTML fragment in your application rule set.

2.
Copy and paste the existing getDateFromFormat from pega_validators.js in this file within the <script></script> tags.




3. Add the condition to check for “0” for invalid years.

Suggest Edit

Published July 14, 2015 - Updated October 8, 2020

Did you find this content helpful? Yes No

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us