Skip to content

Instantly share code, notes, and snippets.

View abdihaikal's full-sized avatar
💭
I may be slow to respond.

Abdi Haikal abdihaikal

💭
I may be slow to respond.
  • Singapore, Singapore
View GitHub Profile
@abdihaikal
abdihaikal / get-days-in-year.js
Last active October 5, 2016 03:38
Get Days in A Year - Date Polyfill
'use strict';
if (!Date.prototype.getDaysInYear) {
Date.prototype.getDaysInYear = function getDaysInYear(year) {
year = year ? year : this.getFullYear();
var days = 0;
for (var i = 1; i < 13; i++) {
days += new Date(year, i, 0).getDate();
}
return days;
};