Re: [jquery-dev] "new Date" style

2009-12-03 Thread Guillermo Rauch
I think it's pretty self-explanatory: + forces the invocation of valueOf to get the primitive value, which in the case of Date is the timestamp. It's the same behavior you would expect if you try to perform another arithmetic operation (new Date * 1) That said, I think that it really doesn't matt

Re: [jquery-dev] "new Date" style

2009-12-03 Thread John Resig
Personally, I find that the expression +new Date is obtuse and doesn't really explain what is happening very well. You're creating an object - then putting a plus next to it - to get some result. Is it a string? a number? Whereas (new Date).getTime() is very explicit: You know that you're getting t

[jquery-dev] "new Date" style

2009-12-03 Thread Ash
Grepping for 'new Date' through the jquery source shows a bit of variety in Date -> Time handling. Casual question really: Is there an aim to get consistency in the code- base, or a "house style" on how to handle dates? Some of the variety seems to come from context and purpose: when you're optim