diff --git a/jqClock-lite.js b/jqClock-lite.js index 6621a53..376ddac 100644 --- a/jqClock-lite.js +++ b/jqClock-lite.js @@ -104,7 +104,7 @@ if (!Date.prototype.hasOwnProperty("getWOY")) { Date.prototype.getWOY = function (getY = false) { const d = new Date(Date.UTC(this.getFullYear(), this.getMonth(), this.getDate())); d.setUTCHours(0, 0, 0, 0); - let dayNum = d.getUTCDay() || 7; + const dayNum = d.getUTCDay() || 7; d.setUTCDate(d.getUTCDate() + 4 - dayNum); if (getY) { return d.getUTCFullYear(); @@ -459,9 +459,10 @@ if (!Number.prototype.map) { $(el).html(clk.calendElem + clk.clockElem); let el_id = $(el).attr("id"); - _jqClock[el_id] = setTimeout(() => { - _updateClock( $(el) ); - }, clk.myoptions.rate); + _jqClock[el_id] = setTimeout( + () => { _updateClock( $(el) ); }, + clk.myoptions.rate + ); }, formatDateString = ( clk ) => { /* Format Date String according to PHP style Format Characters http://php.net/manual/en/function.date.php */ @@ -638,9 +639,9 @@ if (!Number.prototype.map) { const highPrecisionTimestamp = performance.timeOrigin + performance.now(); const sysDateObj = new Date(highPrecisionTimestamp); - // If a server timestamp is passed in and options.isDST is not, then options.isDST isn't any good... + // If a server timestamp is passed in and options.isDST is not, then the default options.isDST isn't any good... // It's no use using a client timestamp's check for DST when a server timestamp is passed! - // To fix this, we will give a console warning when a server timestamp is passed but isDST is not... + // To fix this, we will give a console warning when a server timestamp is passed but the isDST option is not... // In order to do that, we need to save a reference to the original isDST option before ensuring default options const origDST = options.isDST || null; options = ensureDefaultOptions( options, sysDateObj ); diff --git a/jqClock-lite.min.js b/jqClock-lite.min.js index c445fc8..aa2998f 100644 --- a/jqClock-lite.min.js +++ b/jqClock-lite.min.js @@ -1,7 +1,7 @@ Date.prototype.hasOwnProperty("stdTimezoneOffset")||(Date.prototype.stdTimezoneOffset=function(){const d=this.getFullYear();if(!Date.prototype.stdTimezoneOffset.cache.hasOwnProperty(d)){let f=(new Date(d,0,1)).getTimezoneOffset();const e=[6,7,5,8,4,9,3,10,2,11,1];for(let k=0;12>k;k++){const m=(new Date(d,e[k],1)).getTimezoneOffset();if(m!==f){f=Math.max(f,m);break}}Date.prototype.stdTimezoneOffset.cache[d]=f}return Date.prototype.stdTimezoneOffset.cache[d]},Date.prototype.stdTimezoneOffset.cache= {});Date.prototype.hasOwnProperty("isDST")||(Date.prototype.isDST=function(){return this.getTimezoneOffset(){d.clock={version:"2.3.7"};Object.freeze(d.clock);let f={};d.fn.clock=function(e){let k=this;this.initialize=()=>k;this.destroy=()=>k.each((a,b)=>{n.destroy(b)});this.stop=()=>k.each((a,b)=>{n.stop(b)});this.start=()=>k.each((a,b)=>{n.start(b)});const m={d:a=>(""+a.dt).padStart(2,"0"),D:a=>(new Intl.DateTimeFormat(a.myoptions.langSet,{weekday:"short"})).format(a.mytimestamp_sysdiff),j:a=>a.dt,l:a=>(new Intl.DateTimeFormat(a.myoptions.langSet,{weekday:"long"})).format(a.mytimestamp_sysdiff),N:a=> 0===a.dy?7:a.dy,S:a=>{a=a.dt;return 1===a||1===a%10&&11!==a?"st":2===a||2===a%10&&12!==a?"nd":3===a||3===a%10&&13!==a?"rd":"th"},w:a=>a.dy,z:a=>a.doy-1,W:a=>a.woy,F:a=>(new Intl.DateTimeFormat(a.myoptions.langSet,{month:"long"})).format(a.mytimestamp_sysdiff),m:a=>(a.mo+1+"").padStart(2,"0"),M:a=>(new Intl.DateTimeFormat(a.myoptions.langSet,{month:"short"})).format(a.mytimestamp_sysdiff),n:a=>a.mo+1,t:a=>a.dim,L:a=>a.ly?1:0,o:a=>a.iso8601Year,Y:a=>a.y,y:a=>a.y.toString().substr(2,2)},q={a:a=>a.ap.toLowerCase(), diff --git a/jqClock.min.js b/jqClock.min.js index bc54eab..c5be94b 100644 --- a/jqClock.min.js +++ b/jqClock.min.js @@ -1,7 +1,7 @@ Date.prototype.hasOwnProperty("stdTimezoneOffset")||(Date.prototype.stdTimezoneOffset=function(){const d=this.getFullYear();if(!Date.prototype.stdTimezoneOffset.cache.hasOwnProperty(d)){let f=(new Date(d,0,1)).getTimezoneOffset();const e=[6,7,5,8,4,9,3,10,2,11,1];for(let k=0;12>k;k++){const m=(new Date(d,e[k],1)).getTimezoneOffset();if(m!==f){f=Math.max(f,m);break}}Date.prototype.stdTimezoneOffset.cache[d]=f}return Date.prototype.stdTimezoneOffset.cache[d]},Date.prototype.stdTimezoneOffset.cache= {});Date.prototype.hasOwnProperty("isDST")||(Date.prototype.isDST=function(){return this.getTimezoneOffset(){d.clock={version:"2.3.7",options:[{type:"string",value:"destroy",description:"Passing in 'destroy' to an already initialized clock will remove the setTimeout for that clock to stop it from ticking, and remove all html markup and data associated with the plugin instance on the dom elements"},{type:"string",value:"stop",description:"Passing in 'stop' to an already initialized clock will clear the setTimeout for that clock to stop it from ticking"},{type:"string",value:"start",description:"Passing in 'start' to an already initialized clock will restart the setTimeout for that clock to get it ticking again, as though it had never lost time"}, {type:"object",description:"option set {}",values:[{name:"timestamp",description:"Either a javascript timestamp as produced by [JAVASCRIPT new Date().getTime()] or a php timestamp as produced by [PHP time()] ",type:"unix timestamp",values:["javascript timestamp","php timestamp"],default:'"localsystime" which defaults to `new Date(performance.timeOrigin + performance.now()).getTime()`'},{name:"langSet",description:"valid BCP47 locale tag to be used for the translation of Day names and Month names (currently 69 valid tags, can optionally be combined with region)",