I'm writing my first new Angularjs project.
I need to add my custom method (say, addHours()), to a javascript class, say Date().
For completeness, this is my (working) method:
Date.prototype.addHours = function(h) {
this.setHours(this.getHours() + parseInt(h));
return this;
}
Which is the recommended way to do it? Where to put the prototype functions, so they are available through all my project? Should I better create a new Date class? Should I better define an angular service?