New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

blear.utils.date

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blear.utils.date - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

2

package.json
{
"name": "blear.utils.date",
"version": "1.0.6",
"version": "1.0.7",
"description": "date utils",

@@ -5,0 +5,0 @@ "scripts": {

@@ -579,2 +579,25 @@ /**

padStartWithZero(date.getUTCMilliseconds(), 3) + 'Z';
};
/**
* 开始时间(当天 0:0:0:0)
* @param {Date} d1
* @returns {Date}
*/
var start = exports.start = function (d1) {
var d2 = parse(d1);
return new Date(d2.getFullYear(), d2.getMonth(), d2.getDate(), 0, 0, 0, 0);
};
/**
* 结束时间(当天 23:59:59:999)
* @param {Date} d1
* @returns {Date}
*/
exports.end = function (d1) {
var d2 = start(d1);
d2.setDate(d2.getDate() + 1);
return new Date(d2.getTime() - 1);
};

@@ -107,2 +107,28 @@ /**

});
it('.start', function () {
var d1 = new Date();
var d2 = date.start(d1);
expect(d2.getFullYear()).toEqual(d1.getFullYear());
expect(d2.getMonth()).toEqual(d1.getMonth());
expect(d2.getDate()).toEqual(d1.getDate());
expect(d2.getHours()).toEqual(0);
expect(d2.getMinutes()).toEqual(0);
expect(d2.getSeconds()).toEqual(0);
expect(d2.getMilliseconds()).toEqual(0);
});
it('.end', function () {
var d1 = new Date();
var d2 = date.end(d1);
expect(d2.getFullYear()).toEqual(d1.getFullYear());
expect(d2.getMonth()).toEqual(d1.getMonth());
expect(d2.getDate()).toEqual(d1.getDate());
expect(d2.getHours()).toEqual(23);
expect(d2.getMinutes()).toEqual(59);
expect(d2.getSeconds()).toEqual(59);
expect(d2.getMilliseconds()).toEqual(999);
});
});
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc