-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgreg.min.js
More file actions
1 lines (1 loc) · 2.95 KB
/
greg.min.js
File metadata and controls
1 lines (1 loc) · 2.95 KB
1
!function(){"use strict";var a=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.prototype._g_d=function(){return this._g_pad(this._g_j())},Date.prototype._g_D=function(){return this._g_l().substr(0,3)},Date.prototype._g_j=function(){return this.getDate()},Date.prototype._g_l=function(){return a[this.getDay()]},Date.prototype._g_N=function(){return 0===this.getDay()?7:this.getDay()},Date.prototype._g_S=function(){switch(date.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}},Date.prototype._g_w=function(){return this.getDay()},Date.prototype._g_z=function(){return Math.ceil((this-this._g_yearFirst())/864e5)},Date.prototype._g_W=function(){return Math.ceil(((this-this._g_yearFirst())/864e5+this._g_yearFirst().getDay()+1)/7)},Date.prototype._g_F=function(){return b[this.getMonth()]},Date.prototype._g_m=function(){return this._g_pad(this._g_n())},Date.prototype._g_M=function(){return this._g_F().substr(0,3)},Date.prototype._g_n=function(){return this.getMonth()+1},Date.prototype._g_t=function(){return this._g_monthLast().getDate()},Date.prototype._g_L=function(){return 1===new Date(this.getFullYear(),1,29).getMonth()},Date.prototype._g_Y=function(){return this.getFullYear()},Date.prototype._g_y=function(){return parseInt((""+this._g_Y()).slice(-2))},Date.prototype._g_a=function(){return this._g_pastTwelve()?"pm":"am"},Date.prototype._g_A=function(){return this._g_a().toUpperCase()},Date.prototype._g_g=function(){var a=this._g_G();return 0==a||12==a?12:this._g_pastTwelve()?a-12:a},Date.prototype._g_G=function(){return this.getHours()},Date.prototype._g_h=function(){return this._g_pad(this._g_g())},Date.prototype._g_H=function(){return this._g_pad(this._g_G())},Date.prototype._g_i=function(){return this._g_pad(this.getMinutes())},Date.prototype._g_s=function(){return this._g_pad(this.getSeconds())},Date.prototype._g_I=function(){return this.getTimezoneOffset()<this._g_stdTimezoneOffset()},Date.prototype._g_O=function(){return this.getTimezoneOffset()/60*-1},Date.prototype._g_c=function(){return this.toISOString()},Date.prototype._g_r=function(){return this.toString()},Date.prototype._g_U=function(){return Math.floor(this.getTime()/1e3)},Date.prototype._g_pad=function(a){return("0"+a).slice(-2)},Date.prototype._g_yearFirst=function(){return new Date(this.getFullYear(),0,1)},Date.prototype._g_monthLast=function(){return new Date(this.getFullYear(),this.getMonth()+1,0)},Date.prototype._g_pastTwelve=function(){return this._g_G()>=12},Date.prototype._g_stdTimezoneOffset=function(){var a=new Date(this.getFullYear(),6,1);return Math.max(this._g_yearFirst,a.getTimezoneOffset())},Date.prototype.format=function(a){var b=this;return a.replace(/(.?)([dDjlNSwzWFmMntLYyaAgGhHisIOcrU])/g,function(){return"\\"===arguments[1]?arguments[2]:arguments[1]+b["_g_"+arguments[2]]()})}}();