local_time 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16472bce5a32a57abc8ccd393148ce0d484c45ab64613426c20345529b34e1bb
4
- data.tar.gz: 12a94969e30573c97fb7483fee71ad21b0f4e97b58fa0588704a02c9c37b2802
3
+ metadata.gz: 799fafd7b55d67b64c0038f8d9d88a6e521a858916aff976b3bbc6ddd3a588f7
4
+ data.tar.gz: 48000c9b35e80ae555ae629d75734896e9b78deeeb7443ca828f38903fd6c314
5
5
  SHA512:
6
- metadata.gz: 6b2d17fb1670ec4eb2ccc62d66ea98e075ad4a91739c7053c30c07bb89a3f0c84abf19da605ddd45760a1b854b76c9cbe89118bc22974a9265dd25f490bc3ee1
7
- data.tar.gz: b7f22fe3958a23c76e342106eb0defd03cc63e12692d828968c6c5b67ff37149d8be6427e8d21e506c07290eb4c2994c3569fff92d443ff2d75ed5cebbc2333b
6
+ metadata.gz: c6e47fd634ccdfebd71260e05f49d87d6dc80b1aeef0353988d5f8d1f2bc92188073cef9e0a910d0d97fee6d2bc037507669c95b35769a978c8e7b2907ac960f
7
+ data.tar.gz: 3473c5d757047367067087363875824a472adcacd4221a64965c3b1d4d58da3102b569c326c07f55fbe3152bd2c9d9aec80124a0e1093c1ef16f63b8f5e526aa
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2024 Javan Makhmali, Basecamp
1
+ Copyright 2025 Javan Makhmali, Basecamp
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -13,6 +13,9 @@ Local Time makes it easy to display times and dates to users in their local time
13
13
  ```js
14
14
  import LocalTime from "local-time"
15
15
  LocalTime.start()
16
+ document.addEventListener("turbo:morph", () => {
17
+ LocalTime.run()
18
+ })
16
19
  ```
17
20
 
18
21
  ### Webpacker
@@ -131,7 +134,7 @@ Preset time and date formats that vary with age. The available types are `date`,
131
134
 
132
135
  **Internationalization (I18n)**
133
136
 
134
- Local Time includes a [set of default `en` translations](lib/assets/javascripts/src/local-time/config/i18n.coffee) which can be updated directly. Or, you can provide an entirely new set in a different locale:
137
+ Local Time includes a [set of default `en` translations](lib/assets/javascripts/src/local-time/config/i18n.js) which can be updated directly. Or, you can provide an entirely new set in a different locale:
135
138
 
136
139
  ```js
137
140
  LocalTime.config.i18n["es"] = {
@@ -151,6 +154,9 @@ LocalTime.config.i18n["es"] = {
151
154
  LocalTime.config.locale = "es"
152
155
  ```
153
156
 
157
+ > [!NOTE]
158
+ > The "default" keys in the i18n configuration object are used for translations in LocalTime's `RelativeTime` module. They are not used to determine which format is rendered when none is provided. See https://github.com/basecamp/local_time/issues/128 for details.
159
+
154
160
  **24-hour time formatting**
155
161
  Local Time supports 24-hour time formats out of the box.
156
162
 
@@ -1 +1 @@
1
- var t;t={config:{},run:function(){return this.getController().processElements()},process:function(...t){var e,r,a;for(r=0,a=t.length;r<a;r++)e=t[r],this.getController().processElement(e);return t.length},getController:function(){return null!=this.controller?this.controller:this.controller=new t.Controller}};var e,r,a,n,s,i,o,u,l,c,d,m,h,f,g,p,S,v,y,T,b,M,D,w,E,I,C,N,A,O,$,F,Y,k,W,L=t;L.config.useFormat24=!1,L.config.i18n={en:{date:{dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbrDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbrMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yesterday:"yesterday",today:"today",tomorrow:"tomorrow",on:"on {date}",formats:{default:"%b %e, %Y",thisYear:"%b %e"}},time:{am:"am",pm:"pm",singular:"a {time}",singularAn:"an {time}",elapsed:"{time} ago",second:"second",seconds:"seconds",minute:"minute",minutes:"minutes",hour:"hour",hours:"hours",formats:{default:"%l:%M%P",default_24h:"%H:%M"}},datetime:{at:"{date} at {time}",formats:{default:"%B %e, %Y at %l:%M%P %Z",default_24h:"%B %e, %Y at %H:%M %Z"}}}},L.config.locale="en",L.config.defaultLocale="en",L.config.timerInterval=6e4,a=!isNaN(Date.parse("2011-01-01T12:00:00-05:00")),L.parseDate=function(t){return t=t.toString(),a||(t=r(t)),new Date(Date.parse(t))},e=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|[-+]?[\d:]+)$/,r=function(t){var r,a,n,s,i,o,u,l,c,d;if(s=t.match(e))return[r,c,o,a,n,i,l,d]=s,"Z"!==d&&(u=d.replace(":","")),`${c}/${o}/${a} ${n}:${i}:${l} GMT${[u]}`},L.elementMatchesSelector=(n=document.documentElement,s=null!=(i=null!=(o=null!=(u=null!=(l=n.matches)?l:n.matchesSelector)?u:n.webkitMatchesSelector)?o:n.mozMatchesSelector)?i:n.msMatchesSelector,function(t,e){if((null!=t?t.nodeType:void 0)===Node.ELEMENT_NODE)return s.call(t,e)}),({config:c}=L),({i18n:m}=c),L.getI18nValue=function(t="",{locale:e}={locale:c.locale}){var r;return null!=(r=d(m[e],t))?r:e!==c.defaultLocale?L.getI18nValue(t,{locale:c.defaultLocale}):void 0},L.translate=function(t,e={},r){var a,n,s;for(a in s=L.getI18nValue(t,r),e)n=e[a],s=s.replace(`{${a}}`,n);return s},d=function(t,e){var r,a,n,s,i;for(i=t,r=0,n=(s=e.split(".")).length;r<n;r++){if(null==i[a=s[r]])return null;i=i[a]}return i},({getI18nValue:f,translate:M}=L),b="function"==typeof("undefined"!=typeof Intl&&null!==Intl?Intl.DateTimeFormat:void 0),g={"Central European Standard Time":"CET","Central European Summer Time":"CEST","China Standard Time":"CST","Israel Daylight Time":"IDT","Israel Standard Time":"IST","Moscow Standard Time":"MSK","Philippine Standard Time":"PHT","Singapore Standard Time":"SGT","Western Indonesia Time":"WIB"},L.knownEdgeCaseTimeZones=g,L.strftime=T=function(t,e){var r,a,n,s,i,o,u;return a=t.getDay(),r=t.getDate(),i=t.getMonth(),u=t.getFullYear(),n=t.getHours(),s=t.getMinutes(),o=t.getSeconds(),e.replace(/%(-?)([%aAbBcdeHIlmMpPSwyYZ])/g,(function(e,l,c){switch(c){case"%":return"%";case"a":return f("date.abbrDayNames")[a];case"A":return f("date.dayNames")[a];case"b":return f("date.abbrMonthNames")[i];case"B":return f("date.monthNames")[i];case"c":return t.toString();case"d":return p(r,l);case"e":return r;case"H":return p(n,l);case"I":return p(T(t,"%l"),l);case"l":return 0===n||12===n?12:(n+12)%12;case"m":return p(i+1,l);case"M":return p(s,l);case"p":return M("time."+(n>11?"pm":"am")).toUpperCase();case"P":return M("time."+(n>11?"pm":"am"));case"S":return p(o,l);case"w":return a;case"y":return p(u%100,l);case"Y":return u;case"Z":return S(t)}}))},p=function(t,e){return"-"===e?t:`0${t}`.slice(-2)},S=function(t){var e,r,a;return(r=h(t))?g[r]:(a=y(t,{allowGMT:!1}))||(a=v(t))?a:(e=y(t,{allowGMT:!0}))?e:""},h=function(t){return Object.keys(g).find((function(e){return b?new Date(t).toLocaleString("en-US",{timeZoneName:"long"}).includes(e):t.toString().includes(e)}))},y=function(t,{allowGMT:e}){var r;if(b&&(r=new Date(t).toLocaleString("en-US",{timeZoneName:"short"}).split(" ").pop(),e||!r.includes("GMT")))return r},v=function(t){var e,r,a,n,s;return(e=null!=(r=(s=t.toString()).match(/\(([\w\s]+)\)$/))?r[1]:void 0)?/\s/.test(e)?e.match(/\b(\w)/g).join(""):e:(e=null!=(a=s.match(/(\w{3,4})\s\d{4}$/))?a[1]:void 0)||(e=null!=(n=s.match(/(UTC[\+\-]\d+)/))?n[1]:void 0)?e:void 0},L.CalendarDate=class{static fromDate(t){return new this(t.getFullYear(),t.getMonth()+1,t.getDate())}static today(){return this.fromDate(new Date)}constructor(t,e,r){this.date=new Date(Date.UTC(t,e-1)),this.date.setUTCDate(r),this.year=this.date.getUTCFullYear(),this.month=this.date.getUTCMonth()+1,this.day=this.date.getUTCDate(),this.value=this.date.getTime()}equals(t){return(null!=t?t.value:void 0)===this.value}is(t){return this.equals(t)}isToday(){return this.is(this.constructor.today())}occursOnSameYearAs(t){return this.year===(null!=t?t.year:void 0)}occursThisYear(){return this.occursOnSameYearAs(this.constructor.today())}daysSince(t){if(t)return(this.date-t.date)/864e5}daysPassed(){return this.constructor.today().daysSince(this)}},({strftime:E,translate:I,getI18nValue:w,config:D}=L),L.RelativeTime=class{constructor(t){this.date=t,this.calendarDate=L.CalendarDate.fromDate(this.date)}toString(){var t,e;return(e=this.toTimeElapsedString())?I("time.elapsed",{time:e}):(t=this.toWeekdayString())?(e=this.toTimeString(),I("datetime.at",{date:t,time:e})):I("date.on",{date:this.toDateString()})}toTimeOrDateString(){return this.calendarDate.isToday()?this.toTimeString():this.toDateString()}toTimeElapsedString(){var t,e,r,a,n;return r=(new Date).getTime()-this.date.getTime(),a=Math.round(r/1e3),e=Math.round(a/60),t=Math.round(e/60),r<0?null:a<10?(n=I("time.second"),I("time.singular",{time:n})):a<45?`${a} ${I("time.seconds")}`:a<90?(n=I("time.minute"),I("time.singular",{time:n})):e<45?`${e} ${I("time.minutes")}`:e<90?(n=I("time.hour"),I("time.singularAn",{time:n})):t<24?`${t} ${I("time.hours")}`:""}toWeekdayString(){switch(this.calendarDate.daysPassed()){case 0:return I("date.today");case 1:return I("date.yesterday");case-1:return I("date.tomorrow");case 2:case 3:case 4:case 5:case 6:return E(this.date,"%A");default:return""}}toDateString(){var t;return t=this.calendarDate.occursThisYear()?w("date.formats.thisYear"):w("date.formats.default"),E(this.date,t)}toTimeString(){var t;return t=D.useFormat24?"default_24h":"default",E(this.date,w(`time.formats.${t}`))}},({elementMatchesSelector:C}=L),L.PageObserver=class{constructor(t,e){this.processMutations=this.processMutations.bind(this),this.processInsertion=this.processInsertion.bind(this),this.selector=t,this.callback=e}start(){if(!this.started)return this.observeWithMutationObserver()||this.observeWithMutationEvent(),this.started=!0}observeWithMutationObserver(){if("undefined"!=typeof MutationObserver&&null!==MutationObserver)return new MutationObserver(this.processMutations).observe(document.documentElement,{childList:!0,subtree:!0}),!0}observeWithMutationEvent(){return addEventListener("DOMNodeInserted",this.processInsertion,!1),!0}findSignificantElements(t){var e;return e=[],(null!=t?t.nodeType:void 0)===Node.ELEMENT_NODE&&(C(t,this.selector)&&e.push(t),e.push(...t.querySelectorAll(this.selector))),e}processMutations(t){var e,r,a,n,s,i,o,u;for(e=[],r=0,n=t.length;r<n;r++)if("childList"===(i=t[r]).type)for(a=0,s=(u=i.addedNodes).length;a<s;a++)o=u[a],e.push(...this.findSignificantElements(o));return this.notify(e)}processInsertion(t){var e;return e=this.findSignificantElements(t.target),this.notify(e)}notify(t){if(null!=t?t.length:void 0)return"function"==typeof this.callback?this.callback(t):void 0}},({parseDate:O,strftime:$,getI18nValue:A,config:N}=L),L.Controller=function(){var t,e,r,a;return t="time[data-local]:not([data-localized])",e=function(t){return t.setAttribute("data-localized","")},r=function(t){return t.setAttribute("data-processed-at",(new Date).toISOString())},a=function(t){return new L.RelativeTime(t)},class{constructor(){this.processElements=this.processElements.bind(this),this.pageObserver=new L.PageObserver(t,this.processElements)}start(){if(!this.started)return this.processElements(),this.startTimer(),this.pageObserver.start(),this.started=!0}startTimer(){var t;if(t=N.timerInterval)return null!=this.timer?this.timer:this.timer=setInterval(this.processElements,t)}processElements(e=document.querySelectorAll(t)){var r,a,n;for(a=0,n=e.length;a<n;a++)r=e[a],this.processElement(r);return e.length}processElement(t){var n,s,i,o,u,l;if(n=t.getAttribute("datetime"),i=t.getAttribute("data-local"),s=N.useFormat24&&t.getAttribute("data-format24")||t.getAttribute("data-format"),o=O(n),!isNaN(o))return t.hasAttribute("title")||(l=N.useFormat24?"default_24h":"default",u=$(o,A(`datetime.formats.${l}`)),t.setAttribute("title",u)),r(t),t.textContent=function(){switch(i){case"time":return e(t),$(o,s);case"date":return e(t),a(o).toDateString();case"time-ago":return a(o).toString();case"time-or-date":return a(o).toTimeOrDateString();case"weekday":return a(o).toWeekdayString();case"weekday-or-date":return a(o).toWeekdayString()||a(o).toDateString()}}()}}}.call(window),W=!1,F=function(){return document.attachEvent?"complete"===document.readyState:"loading"!==document.readyState},Y=function(t){var e;return null!=(e="function"==typeof requestAnimationFrame?requestAnimationFrame(t):void 0)?e:setTimeout(t,17)},k=function(){return L.getController().start()},L.start=function(){return W?L.run():(W=!0,"undefined"!=typeof MutationObserver&&null!==MutationObserver||F()?k():Y(k))},L.processing=function(){return L.getController().started},window.LocalTime===L&&L.start();export{L as default};
1
+ const t={config:{},run(){this.getController().processElements()},process(...t){for(const e of t)this.getController().processElement(e);return t.length},getController(){return this.controller?this.controller:this.controller=new t.Controller}};t.config.useFormat24=!1,t.config.i18n={en:{date:{dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbrDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbrMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yesterday:"yesterday",today:"today",tomorrow:"tomorrow",on:"on {date}",formats:{default:"%b %e, %Y",thisYear:"%b %e"}},time:{am:"am",pm:"pm",singular:"a {time}",singularAn:"an {time}",elapsed:"{time} ago",second:"second",seconds:"seconds",minute:"minute",minutes:"minutes",hour:"hour",hours:"hours",formats:{default:"%l:%M%P",default_24h:"%H:%M"}},datetime:{at:"{date} at {time}",formats:{default:"%B %e, %Y at %l:%M%P %Z",default_24h:"%B %e, %Y at %H:%M %Z"}}}},t.config.locale="en",t.config.defaultLocale="en",t.config.timerInterval=6e4;const e=!isNaN(Date.parse("2011-01-01T12:00:00-05:00"));t.parseDate=t=>(t=t.toString(),e||(t=function(t){const e=t.match(r);if(e){let t;const[r,a,s,n,i,o,c,u]=e;return"Z"!==u&&(t=u.replace(":","")),`${a}/${s}/${n} ${i}:${o}:${c} GMT${[t]}`}}(t)),new Date(Date.parse(t)));const r=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|[-+]?[\d:]+)$/;t.elementMatchesSelector=(()=>{const t=document.documentElement,e=t.matches||t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector;return(t,r)=>{if(t?.nodeType===Node.ELEMENT_NODE)return e.call(t,r)}})();const{config:a}=t,{i18n:s}=a;t.getI18nValue=(e="",r={locale:a.locale})=>{const{locale:n}=r,i=function(t,e){let r=t;for(var a of Array.from(e.split("."))){if(!r[a])return null;r=r[a]}return r}(s[n],e);return i||(n!==a.defaultLocale?t.getI18nValue(e,{locale:a.defaultLocale}):void 0)},t.translate=(e,r={},a)=>{let s=t.getI18nValue(e,a);for(const t in r){const e=r[t];s=s.replace(`{${t}}`,e)}return s};const{getI18nValue:n,translate:i}=t,o="function"==typeof Intl?.DateTimeFormat,c={"Central European Standard Time":"CET","Central European Summer Time":"CEST","China Standard Time":"CST","Israel Daylight Time":"IDT","Israel Standard Time":"IST","Moscow Standard Time":"MSK","Peru Standard Time":"PET","Philippine Standard Time":"PHT","Singapore Standard Time":"SGT","Western Indonesia Time":"WIB"};t.knownEdgeCaseTimeZones=c,t.strftime=(()=>{const t=(a,s)=>{const u=a.getDay(),l=a.getDate(),d=a.getMonth(),m=a.getFullYear(),h=a.getHours(),f=a.getMinutes(),g=a.getSeconds();return s.replace(/%(-?)([%aAbBcdeHIlmMpPSwyYZ])/g,((s,p,y)=>{switch(y){case"%":return"%";case"a":return n("date.abbrDayNames")[u];case"A":return n("date.dayNames")[u];case"b":return n("date.abbrMonthNames")[d];case"B":return n("date.monthNames")[d];case"c":return a.toString();case"d":return e(l,p);case"e":return l;case"H":return e(h,p);case"I":return e(t(a,"%l"),p);case"l":return 0===h||12===h?12:(h+12)%12;case"m":return e(d+1,p);case"M":return e(f,p);case"p":return i("time."+(h>11?"pm":"am")).toUpperCase();case"P":return i("time."+(h>11?"pm":"am"));case"S":return e(g,p);case"w":return u;case"y":return e(m%100,p);case"Y":return m;case"Z":return function(t){let e,a,s;return(a=function(t){return Object.keys(c).find((e=>o?new Date(t).toLocaleString("en-US",{timeZoneName:"long"}).includes(e):t.toString().includes(e)))}(t))?c[a]:(s=r(t,{allowGMT:!1}))||(s=function(t){const e=t.toString();let r;if(null!=(r=e.match(/\(([\w\s]+)\)$/))){const t=r[1];return/\s/.test(t)?t.match(/\b(\w)/g).join(""):t}if(null!=(r=e.match(/(\w{3,4})\s\d{4}$/)))return r[1];if(null!=(r=e.match(/(UTC[\+\-]\d+)/)))return r[1]}(t))?s:(e=r(t,{allowGMT:!0}))?e:""}(a)}}))};function e(t,e){return"-"===e?t:`0${t}`.slice(-2)}function r(t,{allowGMT:e}){if(o){const r=new Date(t).toLocaleString("en-US",{timeZoneName:"short"}).split(" ").pop();if(e||!r.includes("GMT"))return r}}return t})(),t.CalendarDate=class{static fromDate(t){return new this(t.getFullYear(),t.getMonth()+1,t.getDate())}static today(){return this.fromDate(new Date)}constructor(t,e,r){this.date=new Date(Date.UTC(t,e-1)),this.date.setUTCDate(r),this.year=this.date.getUTCFullYear(),this.month=this.date.getUTCMonth()+1,this.day=this.date.getUTCDate(),this.value=this.date.getTime()}equals(t){return t?.value===this.value}is(t){return this.equals(t)}isToday(){return this.is(this.constructor.today())}occursOnSameYearAs(t){return this.year===t?.year}occursThisYear(){return this.occursOnSameYearAs(this.constructor.today())}daysSince(t){if(t)return(this.date-t.date)/864e5}daysPassed(){return this.constructor.today().daysSince(this)}};const{strftime:u,translate:l,getI18nValue:d,config:m}=t;t.RelativeTime=class{constructor(e){this.date=e,this.calendarDate=t.CalendarDate.fromDate(this.date)}toString(){let t,e;return(e=this.toTimeElapsedString())?l("time.elapsed",{time:e}):(t=this.toWeekdayString())?(e=this.toTimeString(),l("datetime.at",{date:t,time:e})):l("date.on",{date:this.toDateString()})}toTimeOrDateString(){return this.calendarDate.isToday()?this.toTimeString():this.toDateString()}toTimeElapsedString(){let t;const e=(new Date).getTime()-this.date.getTime(),r=Math.round(e/1e3),a=Math.round(r/60),s=Math.round(a/60);return e<0?null:r<10?(t=l("time.second"),l("time.singular",{time:t})):r<45?`${r} ${l("time.seconds")}`:r<90?(t=l("time.minute"),l("time.singular",{time:t})):a<45?`${a} ${l("time.minutes")}`:a<90?(t=l("time.hour"),l("time.singularAn",{time:t})):s<24?`${s} ${l("time.hours")}`:""}toWeekdayString(){switch(this.calendarDate.daysPassed()){case 0:return l("date.today");case 1:return l("date.yesterday");case-1:return l("date.tomorrow");case 2:case 3:case 4:case 5:case 6:return u(this.date,"%A");default:return""}}toDateString(){const t=this.calendarDate.occursThisYear()?d("date.formats.thisYear"):d("date.formats.default");return u(this.date,t)}toTimeString(){const t=m.useFormat24?"default_24h":"default";return u(this.date,d(`time.formats.${t}`))}};const{elementMatchesSelector:h}=t;t.PageObserver=class{constructor(t,e){this.selector=t,this.callback=e,this.processMutations=this.processMutations.bind(this),this.processInsertion=this.processInsertion.bind(this)}start(){this.started||(this.observeWithMutationObserver()||this.observeWithMutationEvent(),this.started=!0)}observeWithMutationObserver(){if("undefined"!=typeof MutationObserver&&null!==MutationObserver){return new MutationObserver(this.processMutations).observe(document.documentElement,{childList:!0,subtree:!0}),!0}return!1}observeWithMutationEvent(){return addEventListener("DOMNodeInserted",this.processInsertion,!1),!0}findSignificantElements(t){const e=[];return t?.nodeType===Node.ELEMENT_NODE&&(h(t,this.selector)&&e.push(t),e.push(...Array.from(t.querySelectorAll(this.selector)||[]))),e}processMutations(t){const e=[];for(const r of t)if("childList"===r.type)for(const t of r.addedNodes)e.push(...this.findSignificantElements(t)||[]);this.notify(e)}processInsertion(t){const e=this.findSignificantElements(t.target);this.notify(e)}notify(t){t?.length>0&&"function"==typeof this.callback&&this.callback(t)}};const{parseDate:f,strftime:g,getI18nValue:p,config:y}=t,S="time[data-local]:not([data-localized])",T=t=>t.setAttribute("data-localized",""),b=e=>new t.RelativeTime(e);t.Controller=class{constructor(){this.processElements=this.processElements.bind(this),this.pageObserver=new t.PageObserver(S,this.processElements)}start(){this.started||(this.processElements(),this.startTimer(),this.pageObserver.start(),this.started=!0)}startTimer(){let t;(t=y.timerInterval)&&(this.timer||(this.timer=setInterval(this.processElements,t)))}processElements(t){t||(t=document.querySelectorAll(S));for(const e of Array.from(t))this.processElement(e);return t.length}processElement(t){const e=t.getAttribute("datetime"),r=t.getAttribute("data-local"),a=y.useFormat24&&t.getAttribute("data-format24")||t.getAttribute("data-format"),s=f(e);if(!isNaN(s)){if(!t.hasAttribute("title")){const e=y.useFormat24?"default_24h":"default",r=g(s,p(`datetime.formats.${e}`));t.setAttribute("title",r)}(t=>{t.setAttribute("data-processed-at",(new Date).toISOString())})(t),t.textContent=(()=>{switch(r){case"time":return T(t),g(s,a);case"date":return T(t),b(s).toDateString();case"time-ago":return b(s).toString();case"time-or-date":return b(s).toTimeOrDateString();case"weekday":return b(s).toWeekdayString();case"weekday-or-date":return b(s).toWeekdayString()||b(s).toDateString()}})()}}};let M=!1;function D(){t.getController().start()}t.start=()=>{var e;M?t.run():(M=!0,"undefined"!=typeof MutationObserver&&null!==MutationObserver||(document.attachEvent?"complete"===document.readyState:"loading"!==document.readyState)?D():(e=D,"function"==typeof requestAnimationFrame?requestAnimationFrame(e):setTimeout(e,17)))},t.processing=()=>t.getController().started,window.LocalTime===t&&t.start();export{t as default};
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).LocalTime=t()}(this,(function(){"use strict";var e;e={config:{},run:function(){return this.getController().processElements()},process:function(...e){var t,r,n;for(r=0,n=e.length;r<n;r++)t=e[r],this.getController().processElement(t);return e.length},getController:function(){return null!=this.controller?this.controller:this.controller=new e.Controller}};var t,r,n,a,i,s,o,u,l,c,d,m,h,f,g,p,y,S,v,T,b,M,D,w,E,I,C,N,A,O,$,F,Y,k,L,W=e;return W.config.useFormat24=!1,W.config.i18n={en:{date:{dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbrDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbrMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yesterday:"yesterday",today:"today",tomorrow:"tomorrow",on:"on {date}",formats:{default:"%b %e, %Y",thisYear:"%b %e"}},time:{am:"am",pm:"pm",singular:"a {time}",singularAn:"an {time}",elapsed:"{time} ago",second:"second",seconds:"seconds",minute:"minute",minutes:"minutes",hour:"hour",hours:"hours",formats:{default:"%l:%M%P",default_24h:"%H:%M"}},datetime:{at:"{date} at {time}",formats:{default:"%B %e, %Y at %l:%M%P %Z",default_24h:"%B %e, %Y at %H:%M %Z"}}}},W.config.locale="en",W.config.defaultLocale="en",W.config.timerInterval=6e4,n=!isNaN(Date.parse("2011-01-01T12:00:00-05:00")),W.parseDate=function(e){return e=e.toString(),n||(e=r(e)),new Date(Date.parse(e))},t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|[-+]?[\d:]+)$/,r=function(e){var r,n,a,i,s,o,u,l,c,d;if(i=e.match(t))return[r,c,o,n,a,s,l,d]=i,"Z"!==d&&(u=d.replace(":","")),`${c}/${o}/${n} ${a}:${s}:${l} GMT${[u]}`},W.elementMatchesSelector=(a=document.documentElement,i=null!=(s=null!=(o=null!=(u=null!=(l=a.matches)?l:a.matchesSelector)?u:a.webkitMatchesSelector)?o:a.mozMatchesSelector)?s:a.msMatchesSelector,function(e,t){if((null!=e?e.nodeType:void 0)===Node.ELEMENT_NODE)return i.call(e,t)}),({config:c}=W),({i18n:m}=c),W.getI18nValue=function(e="",{locale:t}={locale:c.locale}){var r;return null!=(r=d(m[t],e))?r:t!==c.defaultLocale?W.getI18nValue(e,{locale:c.defaultLocale}):void 0},W.translate=function(e,t={},r){var n,a,i;for(n in i=W.getI18nValue(e,r),t)a=t[n],i=i.replace(`{${n}}`,a);return i},d=function(e,t){var r,n,a,i,s;for(s=e,r=0,a=(i=t.split(".")).length;r<a;r++){if(null==s[n=i[r]])return null;s=s[n]}return s},({getI18nValue:f,translate:M}=W),b="function"==typeof("undefined"!=typeof Intl&&null!==Intl?Intl.DateTimeFormat:void 0),g={"Central European Standard Time":"CET","Central European Summer Time":"CEST","China Standard Time":"CST","Israel Daylight Time":"IDT","Israel Standard Time":"IST","Moscow Standard Time":"MSK","Philippine Standard Time":"PHT","Singapore Standard Time":"SGT","Western Indonesia Time":"WIB"},W.knownEdgeCaseTimeZones=g,W.strftime=T=function(e,t){var r,n,a,i,s,o,u;return n=e.getDay(),r=e.getDate(),s=e.getMonth(),u=e.getFullYear(),a=e.getHours(),i=e.getMinutes(),o=e.getSeconds(),t.replace(/%(-?)([%aAbBcdeHIlmMpPSwyYZ])/g,(function(t,l,c){switch(c){case"%":return"%";case"a":return f("date.abbrDayNames")[n];case"A":return f("date.dayNames")[n];case"b":return f("date.abbrMonthNames")[s];case"B":return f("date.monthNames")[s];case"c":return e.toString();case"d":return p(r,l);case"e":return r;case"H":return p(a,l);case"I":return p(T(e,"%l"),l);case"l":return 0===a||12===a?12:(a+12)%12;case"m":return p(s+1,l);case"M":return p(i,l);case"p":return M("time."+(a>11?"pm":"am")).toUpperCase();case"P":return M("time."+(a>11?"pm":"am"));case"S":return p(o,l);case"w":return n;case"y":return p(u%100,l);case"Y":return u;case"Z":return y(e)}}))},p=function(e,t){return"-"===t?e:`0${e}`.slice(-2)},y=function(e){var t,r,n;return(r=h(e))?g[r]:(n=v(e,{allowGMT:!1}))||(n=S(e))?n:(t=v(e,{allowGMT:!0}))?t:""},h=function(e){return Object.keys(g).find((function(t){return b?new Date(e).toLocaleString("en-US",{timeZoneName:"long"}).includes(t):e.toString().includes(t)}))},v=function(e,{allowGMT:t}){var r;if(b&&(r=new Date(e).toLocaleString("en-US",{timeZoneName:"short"}).split(" ").pop(),t||!r.includes("GMT")))return r},S=function(e){var t,r,n,a,i;return(t=null!=(r=(i=e.toString()).match(/\(([\w\s]+)\)$/))?r[1]:void 0)?/\s/.test(t)?t.match(/\b(\w)/g).join(""):t:(t=null!=(n=i.match(/(\w{3,4})\s\d{4}$/))?n[1]:void 0)||(t=null!=(a=i.match(/(UTC[\+\-]\d+)/))?a[1]:void 0)?t:void 0},W.CalendarDate=class{static fromDate(e){return new this(e.getFullYear(),e.getMonth()+1,e.getDate())}static today(){return this.fromDate(new Date)}constructor(e,t,r){this.date=new Date(Date.UTC(e,t-1)),this.date.setUTCDate(r),this.year=this.date.getUTCFullYear(),this.month=this.date.getUTCMonth()+1,this.day=this.date.getUTCDate(),this.value=this.date.getTime()}equals(e){return(null!=e?e.value:void 0)===this.value}is(e){return this.equals(e)}isToday(){return this.is(this.constructor.today())}occursOnSameYearAs(e){return this.year===(null!=e?e.year:void 0)}occursThisYear(){return this.occursOnSameYearAs(this.constructor.today())}daysSince(e){if(e)return(this.date-e.date)/864e5}daysPassed(){return this.constructor.today().daysSince(this)}},({strftime:E,translate:I,getI18nValue:w,config:D}=W),W.RelativeTime=class{constructor(e){this.date=e,this.calendarDate=W.CalendarDate.fromDate(this.date)}toString(){var e,t;return(t=this.toTimeElapsedString())?I("time.elapsed",{time:t}):(e=this.toWeekdayString())?(t=this.toTimeString(),I("datetime.at",{date:e,time:t})):I("date.on",{date:this.toDateString()})}toTimeOrDateString(){return this.calendarDate.isToday()?this.toTimeString():this.toDateString()}toTimeElapsedString(){var e,t,r,n,a;return r=(new Date).getTime()-this.date.getTime(),n=Math.round(r/1e3),t=Math.round(n/60),e=Math.round(t/60),r<0?null:n<10?(a=I("time.second"),I("time.singular",{time:a})):n<45?`${n} ${I("time.seconds")}`:n<90?(a=I("time.minute"),I("time.singular",{time:a})):t<45?`${t} ${I("time.minutes")}`:t<90?(a=I("time.hour"),I("time.singularAn",{time:a})):e<24?`${e} ${I("time.hours")}`:""}toWeekdayString(){switch(this.calendarDate.daysPassed()){case 0:return I("date.today");case 1:return I("date.yesterday");case-1:return I("date.tomorrow");case 2:case 3:case 4:case 5:case 6:return E(this.date,"%A");default:return""}}toDateString(){var e;return e=this.calendarDate.occursThisYear()?w("date.formats.thisYear"):w("date.formats.default"),E(this.date,e)}toTimeString(){var e;return e=D.useFormat24?"default_24h":"default",E(this.date,w(`time.formats.${e}`))}},({elementMatchesSelector:C}=W),W.PageObserver=class{constructor(e,t){this.processMutations=this.processMutations.bind(this),this.processInsertion=this.processInsertion.bind(this),this.selector=e,this.callback=t}start(){if(!this.started)return this.observeWithMutationObserver()||this.observeWithMutationEvent(),this.started=!0}observeWithMutationObserver(){if("undefined"!=typeof MutationObserver&&null!==MutationObserver)return new MutationObserver(this.processMutations).observe(document.documentElement,{childList:!0,subtree:!0}),!0}observeWithMutationEvent(){return addEventListener("DOMNodeInserted",this.processInsertion,!1),!0}findSignificantElements(e){var t;return t=[],(null!=e?e.nodeType:void 0)===Node.ELEMENT_NODE&&(C(e,this.selector)&&t.push(e),t.push(...e.querySelectorAll(this.selector))),t}processMutations(e){var t,r,n,a,i,s,o,u;for(t=[],r=0,a=e.length;r<a;r++)if("childList"===(s=e[r]).type)for(n=0,i=(u=s.addedNodes).length;n<i;n++)o=u[n],t.push(...this.findSignificantElements(o));return this.notify(t)}processInsertion(e){var t;return t=this.findSignificantElements(e.target),this.notify(t)}notify(e){if(null!=e?e.length:void 0)return"function"==typeof this.callback?this.callback(e):void 0}},({parseDate:O,strftime:$,getI18nValue:A,config:N}=W),W.Controller=function(){var e,t,r,n;return e="time[data-local]:not([data-localized])",t=function(e){return e.setAttribute("data-localized","")},r=function(e){return e.setAttribute("data-processed-at",(new Date).toISOString())},n=function(e){return new W.RelativeTime(e)},class{constructor(){this.processElements=this.processElements.bind(this),this.pageObserver=new W.PageObserver(e,this.processElements)}start(){if(!this.started)return this.processElements(),this.startTimer(),this.pageObserver.start(),this.started=!0}startTimer(){var e;if(e=N.timerInterval)return null!=this.timer?this.timer:this.timer=setInterval(this.processElements,e)}processElements(t=document.querySelectorAll(e)){var r,n,a;for(n=0,a=t.length;n<a;n++)r=t[n],this.processElement(r);return t.length}processElement(e){var a,i,s,o,u,l;if(a=e.getAttribute("datetime"),s=e.getAttribute("data-local"),i=N.useFormat24&&e.getAttribute("data-format24")||e.getAttribute("data-format"),o=O(a),!isNaN(o))return e.hasAttribute("title")||(l=N.useFormat24?"default_24h":"default",u=$(o,A(`datetime.formats.${l}`)),e.setAttribute("title",u)),r(e),e.textContent=function(){switch(s){case"time":return t(e),$(o,i);case"date":return t(e),n(o).toDateString();case"time-ago":return n(o).toString();case"time-or-date":return n(o).toTimeOrDateString();case"weekday":return n(o).toWeekdayString();case"weekday-or-date":return n(o).toWeekdayString()||n(o).toDateString()}}()}}}.call(window),L=!1,F=function(){return document.attachEvent?"complete"===document.readyState:"loading"!==document.readyState},Y=function(e){var t;return null!=(t="function"==typeof requestAnimationFrame?requestAnimationFrame(e):void 0)?t:setTimeout(e,17)},k=function(){return W.getController().start()},W.start=function(){return L?W.run():(L=!0,"undefined"!=typeof MutationObserver&&null!==MutationObserver||F()?k():Y(k))},W.processing=function(){return W.getController().started},window.LocalTime===W&&W.start(),W}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).LocalTime=e()}(this,(function(){"use strict";const t={config:{},run(){this.getController().processElements()},process(...t){for(const e of t)this.getController().processElement(e);return t.length},getController(){return this.controller?this.controller:this.controller=new t.Controller}};t.config.useFormat24=!1,t.config.i18n={en:{date:{dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbrDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbrMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yesterday:"yesterday",today:"today",tomorrow:"tomorrow",on:"on {date}",formats:{default:"%b %e, %Y",thisYear:"%b %e"}},time:{am:"am",pm:"pm",singular:"a {time}",singularAn:"an {time}",elapsed:"{time} ago",second:"second",seconds:"seconds",minute:"minute",minutes:"minutes",hour:"hour",hours:"hours",formats:{default:"%l:%M%P",default_24h:"%H:%M"}},datetime:{at:"{date} at {time}",formats:{default:"%B %e, %Y at %l:%M%P %Z",default_24h:"%B %e, %Y at %H:%M %Z"}}}},t.config.locale="en",t.config.defaultLocale="en",t.config.timerInterval=6e4;const e=!isNaN(Date.parse("2011-01-01T12:00:00-05:00"));t.parseDate=t=>(t=t.toString(),e||(t=function(t){const e=t.match(r);if(e){let t;const[r,a,s,n,i,o,c,u]=e;return"Z"!==u&&(t=u.replace(":","")),`${a}/${s}/${n} ${i}:${o}:${c} GMT${[t]}`}}(t)),new Date(Date.parse(t)));const r=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|[-+]?[\d:]+)$/;t.elementMatchesSelector=(()=>{const t=document.documentElement,e=t.matches||t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector;return(t,r)=>{if(t?.nodeType===Node.ELEMENT_NODE)return e.call(t,r)}})();const{config:a}=t,{i18n:s}=a;t.getI18nValue=(e="",r={locale:a.locale})=>{const{locale:n}=r,i=function(t,e){let r=t;for(var a of Array.from(e.split("."))){if(!r[a])return null;r=r[a]}return r}(s[n],e);return i||(n!==a.defaultLocale?t.getI18nValue(e,{locale:a.defaultLocale}):void 0)},t.translate=(e,r={},a)=>{let s=t.getI18nValue(e,a);for(const t in r){const e=r[t];s=s.replace(`{${t}}`,e)}return s};const{getI18nValue:n,translate:i}=t,o="function"==typeof Intl?.DateTimeFormat,c={"Central European Standard Time":"CET","Central European Summer Time":"CEST","China Standard Time":"CST","Israel Daylight Time":"IDT","Israel Standard Time":"IST","Moscow Standard Time":"MSK","Peru Standard Time":"PET","Philippine Standard Time":"PHT","Singapore Standard Time":"SGT","Western Indonesia Time":"WIB"};t.knownEdgeCaseTimeZones=c,t.strftime=(()=>{const t=(a,s)=>{const u=a.getDay(),l=a.getDate(),d=a.getMonth(),m=a.getFullYear(),h=a.getHours(),f=a.getMinutes(),g=a.getSeconds();return s.replace(/%(-?)([%aAbBcdeHIlmMpPSwyYZ])/g,((s,p,y)=>{switch(y){case"%":return"%";case"a":return n("date.abbrDayNames")[u];case"A":return n("date.dayNames")[u];case"b":return n("date.abbrMonthNames")[d];case"B":return n("date.monthNames")[d];case"c":return a.toString();case"d":return e(l,p);case"e":return l;case"H":return e(h,p);case"I":return e(t(a,"%l"),p);case"l":return 0===h||12===h?12:(h+12)%12;case"m":return e(d+1,p);case"M":return e(f,p);case"p":return i("time."+(h>11?"pm":"am")).toUpperCase();case"P":return i("time."+(h>11?"pm":"am"));case"S":return e(g,p);case"w":return u;case"y":return e(m%100,p);case"Y":return m;case"Z":return function(t){let e,a,s;return(a=function(t){return Object.keys(c).find((e=>o?new Date(t).toLocaleString("en-US",{timeZoneName:"long"}).includes(e):t.toString().includes(e)))}(t))?c[a]:(s=r(t,{allowGMT:!1}))||(s=function(t){const e=t.toString();let r;if(null!=(r=e.match(/\(([\w\s]+)\)$/))){const t=r[1];return/\s/.test(t)?t.match(/\b(\w)/g).join(""):t}if(null!=(r=e.match(/(\w{3,4})\s\d{4}$/)))return r[1];if(null!=(r=e.match(/(UTC[\+\-]\d+)/)))return r[1]}(t))?s:(e=r(t,{allowGMT:!0}))?e:""}(a)}}))};function e(t,e){return"-"===e?t:`0${t}`.slice(-2)}function r(t,{allowGMT:e}){if(o){const r=new Date(t).toLocaleString("en-US",{timeZoneName:"short"}).split(" ").pop();if(e||!r.includes("GMT"))return r}}return t})(),t.CalendarDate=class{static fromDate(t){return new this(t.getFullYear(),t.getMonth()+1,t.getDate())}static today(){return this.fromDate(new Date)}constructor(t,e,r){this.date=new Date(Date.UTC(t,e-1)),this.date.setUTCDate(r),this.year=this.date.getUTCFullYear(),this.month=this.date.getUTCMonth()+1,this.day=this.date.getUTCDate(),this.value=this.date.getTime()}equals(t){return t?.value===this.value}is(t){return this.equals(t)}isToday(){return this.is(this.constructor.today())}occursOnSameYearAs(t){return this.year===t?.year}occursThisYear(){return this.occursOnSameYearAs(this.constructor.today())}daysSince(t){if(t)return(this.date-t.date)/864e5}daysPassed(){return this.constructor.today().daysSince(this)}};const{strftime:u,translate:l,getI18nValue:d,config:m}=t;t.RelativeTime=class{constructor(e){this.date=e,this.calendarDate=t.CalendarDate.fromDate(this.date)}toString(){let t,e;return(e=this.toTimeElapsedString())?l("time.elapsed",{time:e}):(t=this.toWeekdayString())?(e=this.toTimeString(),l("datetime.at",{date:t,time:e})):l("date.on",{date:this.toDateString()})}toTimeOrDateString(){return this.calendarDate.isToday()?this.toTimeString():this.toDateString()}toTimeElapsedString(){let t;const e=(new Date).getTime()-this.date.getTime(),r=Math.round(e/1e3),a=Math.round(r/60),s=Math.round(a/60);return e<0?null:r<10?(t=l("time.second"),l("time.singular",{time:t})):r<45?`${r} ${l("time.seconds")}`:r<90?(t=l("time.minute"),l("time.singular",{time:t})):a<45?`${a} ${l("time.minutes")}`:a<90?(t=l("time.hour"),l("time.singularAn",{time:t})):s<24?`${s} ${l("time.hours")}`:""}toWeekdayString(){switch(this.calendarDate.daysPassed()){case 0:return l("date.today");case 1:return l("date.yesterday");case-1:return l("date.tomorrow");case 2:case 3:case 4:case 5:case 6:return u(this.date,"%A");default:return""}}toDateString(){const t=this.calendarDate.occursThisYear()?d("date.formats.thisYear"):d("date.formats.default");return u(this.date,t)}toTimeString(){const t=m.useFormat24?"default_24h":"default";return u(this.date,d(`time.formats.${t}`))}};const{elementMatchesSelector:h}=t;t.PageObserver=class{constructor(t,e){this.selector=t,this.callback=e,this.processMutations=this.processMutations.bind(this),this.processInsertion=this.processInsertion.bind(this)}start(){this.started||(this.observeWithMutationObserver()||this.observeWithMutationEvent(),this.started=!0)}observeWithMutationObserver(){if("undefined"!=typeof MutationObserver&&null!==MutationObserver){return new MutationObserver(this.processMutations).observe(document.documentElement,{childList:!0,subtree:!0}),!0}return!1}observeWithMutationEvent(){return addEventListener("DOMNodeInserted",this.processInsertion,!1),!0}findSignificantElements(t){const e=[];return t?.nodeType===Node.ELEMENT_NODE&&(h(t,this.selector)&&e.push(t),e.push(...Array.from(t.querySelectorAll(this.selector)||[]))),e}processMutations(t){const e=[];for(const r of t)if("childList"===r.type)for(const t of r.addedNodes)e.push(...this.findSignificantElements(t)||[]);this.notify(e)}processInsertion(t){const e=this.findSignificantElements(t.target);this.notify(e)}notify(t){t?.length>0&&"function"==typeof this.callback&&this.callback(t)}};const{parseDate:f,strftime:g,getI18nValue:p,config:y}=t,S="time[data-local]:not([data-localized])",T=t=>t.setAttribute("data-localized",""),b=e=>new t.RelativeTime(e);t.Controller=class{constructor(){this.processElements=this.processElements.bind(this),this.pageObserver=new t.PageObserver(S,this.processElements)}start(){this.started||(this.processElements(),this.startTimer(),this.pageObserver.start(),this.started=!0)}startTimer(){let t;(t=y.timerInterval)&&(this.timer||(this.timer=setInterval(this.processElements,t)))}processElements(t){t||(t=document.querySelectorAll(S));for(const e of Array.from(t))this.processElement(e);return t.length}processElement(t){const e=t.getAttribute("datetime"),r=t.getAttribute("data-local"),a=y.useFormat24&&t.getAttribute("data-format24")||t.getAttribute("data-format"),s=f(e);if(!isNaN(s)){if(!t.hasAttribute("title")){const e=y.useFormat24?"default_24h":"default",r=g(s,p(`datetime.formats.${e}`));t.setAttribute("title",r)}(t=>{t.setAttribute("data-processed-at",(new Date).toISOString())})(t),t.textContent=(()=>{switch(r){case"time":return T(t),g(s,a);case"date":return T(t),b(s).toDateString();case"time-ago":return b(s).toString();case"time-or-date":return b(s).toTimeOrDateString();case"weekday":return b(s).toWeekdayString();case"weekday-or-date":return b(s).toWeekdayString()||b(s).toDateString()}})()}}};let M=!1;function D(){t.getController().start()}return t.start=()=>{var e;M?t.run():(M=!0,"undefined"!=typeof MutationObserver&&null!==MutationObserver||(document.attachEvent?"complete"===document.readyState:"loading"!==document.readyState)?D():(e=D,"function"==typeof requestAnimationFrame?requestAnimationFrame(e):setTimeout(e,17)))},t.processing=()=>t.getController().started,window.LocalTime===t&&t.start(),t}));
@@ -1,3 +1,3 @@
1
1
  module LocalTime
2
- VERSION = "3.0.2"
2
+ VERSION = "3.0.3"
3
3
  end
@@ -7,13 +7,7 @@ require "local_time"
7
7
  require_relative "../../app/helpers/local_time_helper"
8
8
 
9
9
  require "minitest/autorun"
10
- begin
11
- # 2.0.0
12
- class TestCase < MiniTest::Test; end
13
- rescue NameError
14
- # 1.9.3
15
- class TestCase < MiniTest::Unit::TestCase; end
16
- end
10
+ class TestCase < Minitest::Test; end
17
11
 
18
12
  I18n.enforce_available_locales = false
19
13