Socket
Socket
Sign inDemoInstall

dayjs

Package Overview
Dependencies
0
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.9.0 to 1.9.1

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [1.9.1](https://github.com/iamkun/dayjs/compare/v1.9.0...v1.9.1) (2020-09-28)
### Bug Fixes
* Fix objectSupport plugin to get the correct result (zero-based month) ([#1089](https://github.com/iamkun/dayjs/issues/1089)) ([f95ac15](https://github.com/iamkun/dayjs/commit/f95ac15a4577ae5a3d1ce353872a2cd9fc454bc2))
# [1.9.0](https://github.com/iamkun/dayjs/compare/v1.8.36...v1.9.0) (2020-09-28)

@@ -2,0 +9,0 @@

8

esm/plugin/objectSupport/index.js

@@ -19,8 +19,10 @@ export default (function (o, c) {

if (isObject(date)) {
var now = new Date();
Object.keys(date).forEach(function (k) {
$d[prettyUnit(k)] = date[k];
});
var y = $d.year || 1970;
var M = $d.month - 1 || 0;
var d = $d.day || 1;
var d = $d.day || (!$d.year && !($d.month >= 0) ? now.getDate() : 1);
var y = $d.year || now.getFullYear();
var M = $d.month >= 0 ? $d.month : !$d.year && !$d.day ? now.getMonth() : 0; // eslint-disable-line no-nested-ternary,max-len
var h = $d.hour || 0;

@@ -27,0 +29,0 @@ var m = $d.minute || 0;

{
"name": "dayjs",
"version": "1.9.0",
"version": "1.9.1",
"description": "2KB immutable date time library alternative to Moment.js with the same modern API ",

@@ -5,0 +5,0 @@ "main": "dayjs.min.js",

@@ -1,1 +0,1 @@

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.dayjs_plugin_objectSupport=n()}(this,function(){"use strict";return function(t,n){var e=n.prototype,i=function(t){var n,i=t.date,r=t.utc,o={};if(!((n=i)instanceof Date)&&!(n instanceof Array)&&n instanceof Object){Object.keys(i).forEach(function(t){var n,r;o[(n=t,r=e.$utils().p(n),"date"===r?"day":r)]=i[t]});var u=o.year||1970,a=o.month-1||0,c=o.day||1,d=o.hour||0,f=o.minute||0,s=o.second||0,b=o.millisecond||0;return r?new Date(Date.UTC(u,a,c,d,f,s,b)):new Date(u,a,c,d,f,s,b)}return i},r=e.parse;e.parse=function(t){t.date=i.bind(this)(t),r.bind(this)(t)};var o=e.set,u=e.add,a=function(t,n,e,i){if(void 0===i&&(i=1),n instanceof Object){var r=this;return Object.keys(n).forEach(function(e){r=t.bind(r)(n[e]*i,e)}),r}return t.bind(this)(n*i,e)};e.set=function(t,n){return n=void 0===n?t:n,a.bind(this)(function(t,n){return o.bind(this)(n,t)},n,t)},e.add=function(t,n){return a.bind(this)(u,t,n)},e.subtract=function(t,n){return a.bind(this)(u,t,n,-1)}}});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.dayjs_plugin_objectSupport=n()}(this,function(){"use strict";return function(t,n){var e=n.prototype,i=function(t){var n,i=t.date,r=t.utc,o={};if(!((n=i)instanceof Date)&&!(n instanceof Array)&&n instanceof Object){var a=new Date;Object.keys(i).forEach(function(t){var n,r;o[(n=t,r=e.$utils().p(n),"date"===r?"day":r)]=i[t]});var u=o.day||(o.year||o.month>=0?1:a.getDate()),d=o.year||a.getFullYear(),c=o.month>=0?o.month:o.year||o.day?0:a.getMonth(),f=o.hour||0,s=o.minute||0,h=o.second||0,b=o.millisecond||0;return r?new Date(Date.UTC(d,c,u,f,s,h,b)):new Date(d,c,u,f,s,h,b)}return i},r=e.parse;e.parse=function(t){t.date=i.bind(this)(t),r.bind(this)(t)};var o=e.set,a=e.add,u=function(t,n,e,i){if(void 0===i&&(i=1),n instanceof Object){var r=this;return Object.keys(n).forEach(function(e){r=t.bind(r)(n[e]*i,e)}),r}return t.bind(this)(n*i,e)};e.set=function(t,n){return n=void 0===n?t:n,u.bind(this)(function(t,n){return o.bind(this)(n,t)},n,t)},e.add=function(t,n){return u.bind(this)(a,t,n)},e.subtract=function(t,n){return u.bind(this)(a,t,n,-1)}}});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc