Comparing version 1.11.11 to 1.11.12
@@ -7,6 +7,17 @@ import { PluginFunc } from 'dayjs/esm' | ||
declare module 'dayjs/esm' { | ||
export function max(dayjs: Dayjs[]): Dayjs | null | ||
export function max(...dayjs: Dayjs[]): Dayjs | null | ||
export function min(dayjs: Dayjs[]): Dayjs | null | ||
export function min(...dayjs: Dayjs[]): Dayjs | null | ||
export function max(dayjs: [Dayjs, ...Dayjs[]]): Dayjs | ||
export function max(noDates: never[]): null | ||
export function max(maybeDates: Dayjs[]): Dayjs | null | ||
export function max(...dayjs: [Dayjs, ...Dayjs[]]): Dayjs | ||
export function max(...noDates: never[]): null | ||
export function max(...maybeDates: Dayjs[]): Dayjs | null | ||
export function min(dayjs: [Dayjs, ...Dayjs[]]): Dayjs | ||
export function min(noDates: never[]): null | ||
export function min(maybeDates: Dayjs[]): Dayjs | null | ||
export function min(...dayjs: [Dayjs, ...Dayjs[]]): Dayjs | ||
export function min(...noDates: never[]): null | ||
export function min(...maybeDates: Dayjs[]): Dayjs | null | ||
} |
@@ -123,9 +123,18 @@ import { MIN, MS } from '../../constant'; | ||
var diff = Math.round((date - new Date(target)) / 1000 / 60); | ||
var ins = d(target, { | ||
locale: this.$L | ||
}).$set(MS, this.$ms).utcOffset(-Math.round(date.getTimezoneOffset() / 15) * 15 - diff, true); | ||
var offset = -Math.round(date.getTimezoneOffset() / 15) * 15 - diff; | ||
var isUTC = !Number(offset); | ||
var ins; | ||
if (keepLocalTime) { | ||
var newOffset = ins.utcOffset(); | ||
ins = ins.add(oldOffset - newOffset, MIN); | ||
if (isUTC) { | ||
// if utcOffset is 0, turn it to UTC mode | ||
ins = this.utcOffset(0, keepLocalTime); | ||
} else { | ||
ins = d(target, { | ||
locale: this.$L | ||
}).$set(MS, this.$ms).utcOffset(offset, true); | ||
if (keepLocalTime) { | ||
var newOffset = ins.utcOffset(); | ||
ins = ins.add(oldOffset - newOffset, MIN); | ||
} | ||
} | ||
@@ -132,0 +141,0 @@ |
{ | ||
"name": "dayjs", | ||
"version": "1.11.11", | ||
"version": "1.11.12", | ||
"description": "2KB immutable date time library alternative to Moment.js with the same modern API ", | ||
@@ -5,0 +5,0 @@ "main": "dayjs.min.js", |
@@ -7,6 +7,17 @@ import { PluginFunc } from 'dayjs' | ||
declare module 'dayjs' { | ||
export function max(dayjs: Dayjs[]): Dayjs | null | ||
export function max(...dayjs: Dayjs[]): Dayjs | null | ||
export function min(dayjs: Dayjs[]): Dayjs | null | ||
export function min(...dayjs: Dayjs[]): Dayjs | null | ||
export function max(dayjs: [Dayjs, ...Dayjs[]]): Dayjs | ||
export function max(noDates: never[]): null | ||
export function max(maybeDates: Dayjs[]): Dayjs | null | ||
export function max(...dayjs: [Dayjs, ...Dayjs[]]): Dayjs | ||
export function max(...noDates: never[]): null | ||
export function max(...maybeDates: Dayjs[]): Dayjs | null | ||
export function min(dayjs: [Dayjs, ...Dayjs[]]): Dayjs | ||
export function min(noDates: never[]): null | ||
export function min(maybeDates: Dayjs[]): Dayjs | null | ||
export function min(...dayjs: [Dayjs, ...Dayjs[]]): Dayjs | ||
export function min(...noDates: never[]): null | ||
export function min(...maybeDates: Dayjs[]): Dayjs | null | ||
} |
@@ -1,1 +0,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).dayjs_plugin_timezone=e()}(this,(function(){"use strict";var t={year:0,month:1,day:2,hour:3,minute:4,second:5},e={};return function(n,i,o){var r,a=function(t,n,i){void 0===i&&(i={});var o=new Date(t),r=function(t,n){void 0===n&&(n={});var i=n.timeZoneName||"short",o=t+"|"+i,r=e[o];return r||(r=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:i}),e[o]=r),r}(n,i);return r.formatToParts(o)},u=function(e,n){for(var i=a(e,n),r=[],u=0;u<i.length;u+=1){var f=i[u],s=f.type,m=f.value,c=t[s];c>=0&&(r[c]=parseInt(m,10))}var d=r[3],l=24===d?0:d,h=r[0]+"-"+r[1]+"-"+r[2]+" "+l+":"+r[4]+":"+r[5]+":000",v=+e;return(o.utc(h).valueOf()-(v-=v%1e3))/6e4},f=i.prototype;f.tz=function(t,e){void 0===t&&(t=r);var n=this.utcOffset(),i=this.toDate(),a=i.toLocaleString("en-US",{timeZone:t}),u=Math.round((i-new Date(a))/1e3/60),f=o(a,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(15*-Math.round(i.getTimezoneOffset()/15)-u,!0);if(e){var s=f.utcOffset();f=f.add(n-s,"minute")}return f.$x.$timezone=t,f},f.offsetName=function(t){var e=this.$x.$timezone||o.tz.guess(),n=a(this.valueOf(),e,{timeZoneName:t}).find((function(t){return"timezonename"===t.type.toLowerCase()}));return n&&n.value};var s=f.startOf;f.startOf=function(t,e){if(!this.$x||!this.$x.$timezone)return s.call(this,t,e);var n=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return s.call(n,t,e).tz(this.$x.$timezone,!0)},o.tz=function(t,e,n){var i=n&&e,a=n||e||r,f=u(+o(),a);if("string"!=typeof t)return o(t).tz(a);var s=function(t,e,n){var i=t-60*e*1e3,o=u(i,n);if(e===o)return[i,e];var r=u(i-=60*(o-e)*1e3,n);return o===r?[i,o]:[t-60*Math.min(o,r)*1e3,Math.max(o,r)]}(o.utc(t,i).valueOf(),f,a),m=s[0],c=s[1],d=o(m).utcOffset(c);return d.$x.$timezone=a,d},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(t){r=t}}})); | ||
!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).dayjs_plugin_timezone=e()}(this,(function(){"use strict";var t={year:0,month:1,day:2,hour:3,minute:4,second:5},e={};return function(n,i,o){var r,a=function(t,n,i){void 0===i&&(i={});var o=new Date(t),r=function(t,n){void 0===n&&(n={});var i=n.timeZoneName||"short",o=t+"|"+i,r=e[o];return r||(r=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:i}),e[o]=r),r}(n,i);return r.formatToParts(o)},u=function(e,n){for(var i=a(e,n),r=[],u=0;u<i.length;u+=1){var f=i[u],s=f.type,m=f.value,c=t[s];c>=0&&(r[c]=parseInt(m,10))}var d=r[3],l=24===d?0:d,h=r[0]+"-"+r[1]+"-"+r[2]+" "+l+":"+r[4]+":"+r[5]+":000",v=+e;return(o.utc(h).valueOf()-(v-=v%1e3))/6e4},f=i.prototype;f.tz=function(t,e){void 0===t&&(t=r);var n,i=this.utcOffset(),a=this.toDate(),u=a.toLocaleString("en-US",{timeZone:t}),f=Math.round((a-new Date(u))/1e3/60),s=15*-Math.round(a.getTimezoneOffset()/15)-f;if(!Number(s))n=this.utcOffset(0,e);else if(n=o(u,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(s,!0),e){var m=n.utcOffset();n=n.add(i-m,"minute")}return n.$x.$timezone=t,n},f.offsetName=function(t){var e=this.$x.$timezone||o.tz.guess(),n=a(this.valueOf(),e,{timeZoneName:t}).find((function(t){return"timezonename"===t.type.toLowerCase()}));return n&&n.value};var s=f.startOf;f.startOf=function(t,e){if(!this.$x||!this.$x.$timezone)return s.call(this,t,e);var n=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return s.call(n,t,e).tz(this.$x.$timezone,!0)},o.tz=function(t,e,n){var i=n&&e,a=n||e||r,f=u(+o(),a);if("string"!=typeof t)return o(t).tz(a);var s=function(t,e,n){var i=t-60*e*1e3,o=u(i,n);if(e===o)return[i,e];var r=u(i-=60*(o-e)*1e3,n);return o===r?[i,o]:[t-60*Math.min(o,r)*1e3,Math.max(o,r)]}(o.utc(t,i).valueOf(),f,a),m=s[0],c=s[1],d=o(m).utcOffset(c);return d.$x.$timezone=a,d},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(t){r=t}}})); |
@@ -8,4 +8,4 @@ English | [简体中文](./docs/zh-cn/README.zh-CN.md) | [日本語](./docs/ja/README-ja.md) | [Português Brasileiro](./docs/pt-br/README-pt-br.md) | [한국어](./docs/ko/README-ko.md) | [Español (España)](./docs/es-es/README-es-es.md) | [Русский](./docs/ru/README-ru.md) | [Türkçe](./docs/tr/README-tr.md) | [සිංහල](./docs/si/README-si.md) | [עברית](./docs/he/README-he.md) | ||
<p align="center"> | ||
<a href="https://unpkg.com/dayjs/dayjs.min.js"><img | ||
src="https://img.badgesize.io/https://unpkg.com/dayjs/dayjs.min.js?compression=gzip&style=flat-square" | ||
<a href="https://bundlephobia.com/package/dayjs"><img | ||
src="https://img.shields.io/bundlephobia/minzip/dayjs?style=flat-square&color=%2345cc11" | ||
alt="Gzip Size"></a> | ||
@@ -119,4 +119,4 @@ <a href="https://www.npmjs.com/package/dayjs"><img src="https://img.shields.io/npm/v/dayjs.svg?style=flat-square&colorB=51C838" | ||
| ||
<a href="https://github.com/alan-eu" target="_blank"> | ||
<img width="70" src="https://avatars.githubusercontent.com/u/18175329?s=52&v=4"> | ||
<a href="https://github.com/ken-swyfft" target="_blank"> | ||
<img width="70" src="https://avatars.githubusercontent.com/u/65305317?v=4"> | ||
</a> | ||
@@ -132,6 +132,10 @@ | ||
| ||
<a href="https://github.com/ken-swyfft" target="_blank"> | ||
<img width="70" src="https://avatars.githubusercontent.com/u/65305317?v=4"> | ||
<a href="https://github.com/alan-eu" target="_blank"> | ||
<img width="70" src="https://avatars.githubusercontent.com/u/18175329?s=52&v=4"> | ||
</a> | ||
| ||
<a href="https://www.exoflare.com/open-source/?utm_source=dayjs&utm_campaign=open_source" target="_blank"> | ||
<img width="70" src="https://user-images.githubusercontent.com/17680888/162761622-1407a849-0c41-4591-8aa9-f98114ec2092.png"> | ||
</a> | ||
| ||
<a href="https://github.com/storyblok" target="_blank"> | ||
@@ -141,14 +145,7 @@ <img width="70" src="https://avatars.githubusercontent.com/u/13880908?s=200&v=4"> | ||
| ||
<a href="https://www.exoflare.com/open-source/?utm_source=dayjs&utm_campaign=open_source" target="_blank"> | ||
<img width="70" src="https://user-images.githubusercontent.com/17680888/162761622-1407a849-0c41-4591-8aa9-f98114ec2092.png"> | ||
</a> | ||
| ||
<a href="https://bestkru.com/" target="_blank"> | ||
<img width="70" src="https://avatars.githubusercontent.com/u/159320286" alt="BestKru"> | ||
</a> | ||
| ||
<a href="https://opencollective.com/anonstories" target="_blank"><img width="70" src="https://images.opencollective.com/anonstories/7e826c0/avatar/256.png"></a> | ||
| ||
<a href="https://opencollective.com/datawrapper" target="_blank"><img width="70" src="https://images.opencollective.com/datawrapper/c13e229/logo.png"></a> | ||
## Contributors | ||
@@ -155,0 +152,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
669061
451
10218
165