[Herts] LUG date javascript quick fix

David Precious davidp at preshweb.co.uk
Thu Nov 1 20:19:13 GMT 2007


James Ronan wrote:
> Hi Kevin,
> 
> True, but it believed that Oct was 9 and Dec was 10 ?
> 
> It has to be something to do with the way it adds a month, a rounding error
> or some such as its now working correctly. I guess it was because it was on
> the 31st.

Give the man a doughnut, I believe that'll be the answer.  It's probably
adding one to the month, without regard to the day.  On 31st October,
adding a month would give you 31st November - but there's no such day,
so it probably ends up in December.

I've not looked at the code, but I'd create a date for the 1st of the
current month, then add a month to that.

Cheers

Dave P

-- 
David Precious
davidp at preshweb.co.uk :: http://blog.preshweb.co.uk/

   "Programming is like sex. One mistake and you have to support
      it for the rest of your life". (Michael Sinz)



More information about the Herts mailing list