I am way behind on my reading list in google reader (it says 1000+). After reading this:
(describing turning the string values of input boxes into date values and then doing a comparison to validate that one is no more than a year from the other)
This could have been a good post if:
- The subject matter was non-trivial.
- The code was internationalized (hence making the subject matter non-trivial).
- There weren't any grammar mistakes.
- Simple date math (Is date 1 within 1 year of date two?) is and should be a trivial problem in any programming language.
- The code provided only works in locales that format their dates like en-GB (dd/mm/yyyy).
- The first 3 lines are not a single sentence; words are spelled wrong; spaces are missing. Also one of the comments makes no sense whatsoever.
var fromDate = new Date();
var toDate = new Date();
var maxAllowableToDate = fromDate;
if(fromDate < toDate && toDate < maxAllowableToDate) ...