javascript comparing strings (for date purposes)
<p>Ive only ever done absolute comparisons before, so Im a bit stuck as to how to deal with this...</p>

<p>I have two strings returned from PHP (format is DATE_ATOM i.e 2012-01-20)</p>

<p>What I need to do is compare one string (date) against another - however, I need to return true on the following three conditions</p>

<ul>
<li>The first date matches the second date (== got this one...)</li>
<li>The first date matches the second date +1 day </li>
<li>The first date matches the second date +2 days</li>
</ul>

<p>Anything over that will return false.</p>

<p>How can I do this in as 'clean' a way as possible..</p>

<p>P.S This can be done in either PHP or Javascript - just the cleanest way possible would be prefered!!!</p>

<p>Many thanks in advance!</p>
