I added the following:
// Add timeZone Date.prototype.addTimeZone = function () { if(this.getTimezoneOffset() > 0){ this.setMinutes(this.getTimezoneOffset()); } return this; };
And this is on my controller / model:
new Date(myDate).addTimeZone();
To resume:
expanding-date prototype.js
// Add timeZone Date.prototype.addTimeZone = function () { if(this.getTimezoneOffset() > 0){ this.setMinutes(this.getTimezoneOffset()); } return this; }; // Remove TimeZone Date.prototype.toJSON = function(){ return moment(this).format('YYYY-MM-DD') + 'T00:00:00.000Z'; };
view.html
<p ng-bind="(myDate | date:'dd/MM/yyyy')"></p>
controller.js
new Date(myDate).addTimeZone();
I am using moment.js
source share