Created
April 29, 2014 13:24
-
-
Save nobleach/11400269 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildQuery: function() { | |
var query = []; | |
var name = this.username.value; | |
var startDate = this.startDate.value; | |
var endDate = this.endDate.value; | |
if(name) { | |
query.push("username LIKE '%"+name+"%'"); | |
} | |
if(startDate) { | |
query.push("time > '"+startDate+"'"); | |
} | |
if(endDate) { | |
query.push("time < '"+endDate+"'"); | |
} | |
if(query.length > 1) { | |
return query.join(' AND '); | |
} else { | |
return query.join(''); | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment