Permalink
Browse files

fix: handles pre-epoch dates for cassandra < 2.*

  • Loading branch information...
1 parent 10e4821 commit ea4d28313f99ac86ab0dd71e36345381a28c0fec @tim-dev tim-dev committed Nov 15, 2013
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/connection.js
View
@@ -103,11 +103,15 @@ function escapeCQL(val) {
}
if(val instanceof Date){
- val = val.getTime();
- if(isNaN(val)){
+ _val = val.getTime();
+ if(isNaN(_val)){
throw errors.create(new Error('Invalid Date'));
}
- return val;
+ // For cassandra < 2
+ if(_val<0){
+ _val = "'"+val.toISOString()+"'";
+ }
+ return _val;
}
if(typeof val === 'number' || typeof val === 'boolean'){

0 comments on commit ea4d283

Please sign in to comment.