Last active
December 7, 2018 12:18
-
-
Save marcobraghim/b73096f76982545c6f8e1919a4c77f7f to your computer and use it in GitHub Desktop.
Own Thizer js commons functions
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
String.prototype.inArray = function(arr) { | |
if (typeof arr !== 'object') { | |
return false | |
} | |
var result = false | |
for (var i in arr) { | |
if (this.toString() == arr[i]) { | |
result = true | |
break | |
} | |
} | |
return result | |
} | |
/** | |
* Add to the Date object a function to get future days from | |
* current date. | |
* | |
* @param {int} days | |
* @returns {Date} | |
*/ | |
Date.prototype.addDays = function(days) { | |
return new Date( | |
this.getFullYear(), | |
this.getMonth(), | |
this.getDate()+days, | |
this.getHours(), | |
this.getMinutes(), | |
this.getSeconds() | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment