IAmMyself / datejs

Automatically exported from code.google.com/p/datejs
Other
0 stars 0 forks source link

Bad logic #158

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Date.validateHour(25)
2. Date.validateMinute(25)

What is the expected output? What do you see instead?

They throw a RangeError if false. Errors are for catching unexpected behaviour. 
False is not unexpected!

What version of the product are you using? On what operating system?
Current

Please provide any additional information below.

Original issue reported on code.google.com by peter01....@gmail.com on 16 Aug 2012 at 9:55

GoogleCodeExporter commented 8 years ago
Correct - while it's semantically correct to throw a RangeError here it's not 
very sensible - failing validation is not an exceptional circumstance and 
shouldn't be treated as such.

I patched this (but left the TypeError, that is correct) in my fork: 
https://github.com/abritinthebay/datejs/

Original comment by darkcr...@gmail.com on 9 Sep 2013 at 11:15