-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Purge remainder of calls to new Date
.
#112
Conversation
@@ -264,7 +264,7 @@ PCBucket.prototype.getFormatRevision = function(restbase, req) { | |||
.then(function(apiRes) { | |||
if (apiRes.status === 200) { | |||
var apiRev = apiRes.body.items[0].revisions[0]; | |||
var tid = rbUtil.tidFromDate(new Date(apiRev.timestamp)); | |||
var tid = rbUtil.tidFromDate(+apiRev.timestamp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+apiRev.timestamp
What does the leading plus do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coerces to numeric, just to be safe. Below in the tidToDate method it should catch the oddball case where (say) date.getTime() is a method, but returns some non-numeric value, like {}
, since isNaN(+{}) === true
.
Here it will ensure that apiRev.timestamp
is treated as a number, even if it happens to be a string like "123"
. (Note that new Date("2")
does surprising things, which this code previously didn't protect against.)
Travis does not seem to be happy, and it doesn't look like a transient issue to me. |
It's possible I screwed something up, I'll figure out how to run the test suite later tonight. |
@cscott, to run the tests, you need to install & run cassandra locally. With that in place, it's just |
Note: there are multiple options for installing Cassandra. I found the quickest method was to download the tarball, extract it, and run bin/cassandra. |
I'm preferring On Wed, Jan 7, 2015 at 4:42 PM, James Earl Douglas <notifications@github.com
|
:sadface: |
http://wiki.apache.org/cassandra/DebianPackaging On Wed, Jan 7, 2015 at 4:45 PM, James Earl Douglas <notifications@github.com
|
Use `Date.now` and `Date.parse` instead.
1 similar comment
Fixed. ( |
Purge remainder of calls to `new Date`.
Use
Date.now
andDate.parse
instead.