Skip to content

Instantly share code, notes, and snippets.

@marcobraghim
Last active December 7, 2018 12:18
Show Gist options
  • Save marcobraghim/b73096f76982545c6f8e1919a4c77f7f to your computer and use it in GitHub Desktop.
Save marcobraghim/b73096f76982545c6f8e1919a4c77f7f to your computer and use it in GitHub Desktop.
Own Thizer js commons functions
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