Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Bug Reports » std.datevalidation.class.inc
std.datevalidation.class.inc [message #736] Sun, 01 April 2007 04:32 Go to next message
null byte is currently offline  null byte
Messages: 1
Registered: March 2007
Junior Member
Hi,

I was reading through your std.datevalidation.class.inc to get some ideas on using regular expressions and think i found a bug:

In your:

function verifyTime($hours, $minutes, $seconds) 


I think the statement:

if ($hours > 24)


should actually be

if ($hours > 23)


as this would validate 24 as a valid hour where we would move to 00.


Anyway nice to see some well documented and formatted code Smile
Re: std.datevalidation.class.inc [message #737 is a reply to message #736] Sun, 01 April 2007 05:05 Go to previous message
AJM is currently offline  AJM
Messages: 2312
Registered: April 2006
Location: Surrey, UK
Senior Member
You are quite correct. Thanks for spotting that.

I'm glad you like my style of documentation. When I see complex regular expressions I hate to see a single long string as it can take some while to work out exactly what it does. By breaking it down into its component parts, which can then be commented, it makes it easier for everyone - both a newcomer AND the original author.

I learned a valuable lesson many years ago when I wrote some complex code without any comments. When I came to look at it 6 months later it took me ages to figure out what was going on. I realised then that it is far better to insert comments as you are writing the code than to try and figure it out later.

You will find lots of other regular expressions in my code, especially in file include.general.inc, but it is such a complex and powerful area that I am learning new things myself every day.


Previous Topic: multi3 and multi4
Next Topic: multi2
Goto Forum:
  


Current Time: Sun Jan 29 07:41:35 EST 2023

Total time taken to generate the page: 0.01659 seconds