Backendless Support
 
Solved

4.0 Console: Date Validation Fails

Hi all,

I think I may have found a bug with how date fields are validated ...

I have a table with Time_Start and Time_End columns that both have the Backendless "Date/Time" validator.

436b84f5370d5b999f46d6e35aa44a90

When I try to create a new object via console, the validation fails with the standard format the console creates:

ddbbd484d6519563ca800cc27aad9576

Renato

Leave a Comment

Comments (3)

photo
1

Hi Renato,

The regex used for that built-in validator looks ridiculously complex:

^([0]?[1-9]|[1][0-2])[./-]([0]?[1-9]|[1|2][0-9]|[3][0|1])[./-]([0-9]{4}|[0-9]{2}) (([0-9])|([0-1][0-9])|([2][0-3])):?([0-5][0-9]):?([0-5][0-9]) GMT[+|-][0-9][0-9][0-9][0-9]$|^(((0?[1-9]|[12]\d|3[01])[\.\-\/](0?[13578]|1[02])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|((0?[1-9]|[12]\d|30)[\.\-\/](0?[13456789]|1[012])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|((0?[1-9]|1\d|2[0-8])[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|(29[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00|[048]))) (([0-9])|([0-1][0-9])|([2][0-3])):?([0-5][0-9]):?([0-5][0-9]) GMT[+|-][0-9][0-9][0-9][0-9]$

A workaround would be to create a custom regex. Please let us know if you come up with one that works for you. Meanwhile, we will look into it as well, though this is not going to be high priority because there is a workaround with a custom regex.

Regards,

Mark

photo
1

Here's a custom regex which will match the format created by console:

^([0]?[1-9]|[1][0-2])[./-]([0]?[1-9]|[1|2][0-9]|[3][0|1])[./-]([0-9]{4}|[0-9]{2}) (([0-9])|([0-1][0-9])|([2][0-3])):?([0-5][0-9]):?([0-5][0-9])$

The format is:

MM/DD/YYYY hh:mm:ss

Regards,

Mark

photo
1

Hi Mark - Absolutely, and in fact, I removed the regex for the time being, as it is also not a deal breaker for me.

Just thought I'd let you guys know about it! :)

Cheers,

Renato